make two applications that communicate

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hashc
    New Member
    • Jan 2009
    • 4

    make two applications that communicate

    hi
    i want to be able to have two applications in c# visual studio.net 2008 to be able to communicate with each other by passing parameters.
    for example; Appli1.exe is a form with 4 buttons
    Appli2.exe should be executed when a particular button is pressed in Appli1.exe, but it should know which button has been pressed,

    therefore i want to make a call to second application, such as:

    Appli2.exe(butt on number) if i were to put it crudely!

    i have done something like this in c++ within QNX enviroment, but havent a clue of how to do it in c#...
  • vekipeki
    Recognized Expert New Member
    • Nov 2007
    • 229

    #2
    One way would be the EventWaitHandle Class (System.Threadi ng). EventWaitHandle class provides access to named system synchronization events, which means that by providing a name for your event, you can get a handle to the same system event in multiple processes:

    Code:
    EventWaitHandle ewh = new EventWaitHandle(false, EventResetMode.AutoReset, "SomeUniqueName");

    Comment

    • hashc
      New Member
      • Jan 2009
      • 4

      #3
      so the "someuniquename " can be a .exe application?
      how do i pass parameters between the two applications?

      Comment

      • vekipeki
        Recognized Expert New Member
        • Nov 2007
        • 229

        #4
        For simple inter-process synchronization , you can use named EventWaitHandle , Mutex and Semaphore classes. You cannot use them to send information, but you can have several events with different names. Name of the event can be anything you like, but you should consider making it unique to avoid collisions with other programs (e.g. "YourApp.SomeEv ent", "YourApp.SomeOt herEvent" etc.)

        If you want to exchange data between applications, Remoting is the way to go. Google it for some examples (check this thread also: http://bytes.com/groups/net-c/253478...-communication).

        Comment

        • hashc
          New Member
          • Jan 2009
          • 4

          #5
          thanks vekipeki, i will give it a try and see how it works..

          Comment

          Working...