2

in Process A I need to receive an event from Proces B. I decided to use EventWaitHandle. In both processes i write this code:

var evhandle = new EventWaitHandle(false, EventResetMode.AutoReset,"MyGUID1221");

then in process A i invoke Set() method:

evhandle.Set();

How i can to receive "MyGUID1221" event in process B and do some actions? How to make "MyGUID1221"Listener?

Thanks.

WelcomeTo
  • 19,843
  • 53
  • 170
  • 286

1 Answers1

4

The "MyGUID121" is just the name for the system-wide event. You listen (read wait) for the event by using the WaitOne - method

Random Dev
  • 51,810
  • 9
  • 92
  • 119
  • i add evhandle.WaitOne(); method to process A, but how i can to run some function when MyGUID1221" event is invoked? I dont see some EventWaitHandle events, which rises when system invoke MyGUID1221 event – WelcomeTo Oct 03 '11 at 10:40
  • WaitOne will wait for the event to be set. You can check if the event is set by using WaitOne(0) (will return true if set and false if not) - there are no events as you usually know them but you can use a Task to await the handle and/or ContinueWith on this as some kind of event-handler – Random Dev Oct 03 '11 at 11:36