Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For simple scenarios a plain old windows event would be enough - a program waits to be signaled to do something.</p> <p>Spawn a thread in the waiting program that waits for the event. </p> <pre><code>//Program 1 EventWaitHandle evt = OpenOrCreateEvent("Global\\MyEvent"); evt.WaitOne(); // this thread will block waiting without wasting CPU cycles, // it will be be signaled from the kernel // when the event is set DoStuff(); //Program 2 EventWaitHandle evt = OpenOrCreateEvent("Global\\MyEvent"); evt.Set(); </code></pre> <p>Take a look at the EventWaitHandle, ManualResetEvent, AutoResetEvent classes.</p> <ul> <li>Consider which program is going to create the event - you could try to open the event from both programs, if it doesn't exist than create it.</li> <li>Prefix the event name with 'Global\' if one of the programs is a service ( and/or running in other session/user). Otherwise it won't work on Vista or later. </li> <li>When creating the event you may need to set security attributes so it can be opened from other processes from other sessions.</li> </ul> <p>Advanced IPC mechanisms like WCF, Remoting, DCOM, CORBA, etc may be better if you have more complicated communication protocol with different actions to trigger, return values and so on. For simple cases (a couple) of windows events would be enough.</p> <p><strong>Notice</strong> If you need to transfer data between your processes consider memory mapped files. "Official" .NET classes for them will be available with .NET 4.0, currently you can use <a href="http://github.com/tomasr/filemap/tree/master" rel="nofollow noreferrer">http://github.com/tomasr/filemap/tree/master</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload