Raise "global" events in .NET via an executable

I'm not sure how to do this, and what to look for ...

I need a simple executable file that "raises an event". I know this sound is crazy and most likely described with the wrong terms. Let's go back to a few steps and describe the scenario:

I just bought a nice Wacom Pen + Touch. I also have a Logitech MX laser mouse with some fance buttons. And my keyboard has nice function buttons too ... So many ways to control things and I tend to do "everything" in .NET and WPF (hopefully in the near future).

The problem, however, is that I don't have time to dig into each of the drivers to make sure they work natively with .NET. But most custom applications (wacom, setpoint) allow you to assign applications to buttons.

So my idea is a simple executable, compiled for just one purpose: creating an event on call. Something like "WacomButton1Pressed.exe".

I know WCF, but I think this is too much, the application shouldn't connect to the webservice. Is there any other "loosely coupled" model in .NET that allows me to subscribe to "global events". I know a little about app domains as starters assume everything is running at the lowest security level (GAC is off, I'm an administrator, Windows 7) ...

Is there any "global" event broker (comparable to EventAggregator in PRISM, for example) at the operating system level where I can raise and listen for events. If not, any idea of ​​a workaround that requires little or no "detailed knowledge" (this is a kind of low priority game, so on the one hand I want to do it "right", on the other hand I don’t spend a lot of time doing basic research : -)

Thanks for any advice, Chris

PS: search terms are welcome, event is not the most google-friendly word :-)

+2


source to share


4 answers


I know you have already reviewed and rejected WCF , but I would encourage you to reconsider. WCF is much more than web services - basically, it should be your default choice in the communication stack as soon as you need to talk across processes (whether internally on the same machine or across machine boundaries).



You can use named pipes with WCF, which is what I will do in this scenario.

+2


source


Sheer speculation ... Perhaps you can do this with WMI .. Subscribe to certain WMI events and, when you fire them, somehow respond to them with your application?



0


source


WCF is not just web services like others, and is probably the most appropriate .NET technology to use in messaging solutions.

I would suggest:

  • Define a simple WCF service and work contract to handle the event
  • Create a simple console application that hosts the WCF service and implements the contract; when he receives a message, he can open the message or do whatever you want. It doesn't have to be a console application, it can be WPF, Winform, Windows service, which is most appropriate - any .NET executable can host a WCF service.
  • Create your "WacomButton1Pressed.exe" which creates a proxy (or uses a ChannelFactory) to send a message to your listener.

Then just connect your mouse / input buttons to invoke the application (if it's a console application, you can even pass command line parameters using the configuration tool, ie "WacomButtonPressed.exe -button1"

When you want to start, start the listener, then click and send messages.

0


source


Besides WCF, Windows actually has another "global" event broker: MSMQ

If you set up a private queue without a transaction, it can handle thousands if not tens of thousands of messages per second if they are small messages (as I get the impression that they will be here).

Then you just need another application to poll the queue.

There's an easy to use .NET API for MSMQ.

The only drawback is that you will need to install the MSMQ Windows service (this is a free part of every Windows 2000 version, but not installed by default).

0


source







All Articles