How to send events from one windows app to another windows app

  • Thread starter Thread starter David Elliott
  • Start date Start date
D

David Elliott

I have a context menu program and am wanting to send information from it
to a windows application.

The Windows app has the delegate method defined to catch the event

The Context Menu App is wired to send the event with the exception of
it needs some place to send it to. The OnAddJobEvent is null at this
point because the context menu doesn't want to receive the event, it
just wants to send it.

Any help would be appreciated.
Dave


===========================

public delegate void AddJobNotificationEventHandler(object sender, AddJobEventArgs args);

public class AddJobNotification
{
public event AddJobNotificationEventHandler OnAddJobEvent;

public void AddJob(...)
{
if ( OnAddJobEvent != null )
{
AddJobEventArgs args = new AddJobEventArgs(...);
OnAddJobEvent(this, args);
}
}
}
 
Hi David,

I think event is kind of callback mechanism, which we can also consider the
delegate as the function point.
Because the memory address(function point or memory address) in one process
is not valid in another process, we can not send the event from one winapp
to another.
For this scenario, we have to use IPC, e.g. sendmessage or postmessage to
send message from one process to another and in another process we can
handle the msg in the winproc to invoke the according method

Or you may try to take a look at google thread below to see if the remoting
will help in your scenario.
http://groups.google.com/groups?hl=zh-CN&lr=&c2coff=1&threadm=LYCWWfGmDHA.26
24%40cpmsftngxa06.phx.gbl&rnum=1&prev=/groups%3Fhl%3Dzh-CN%26lr%3D%26c2coff%
3D1%26q%3Dremoting%2Bevent%2B%2522peter%2Bhuang%2522.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top