Sending Window Messages from an MFC app to a Windows Firm tray application

  • Thread starter Thread starter Janiv Ratson
  • Start date Start date
J

Janiv Ratson

Hello,

I have an MFC MDI application and a Windows Forms (2.0) Tray Icon
application.
I want to run a command on the tray application via my MFC application.
There is a "Register" context menu command on the tray icon application.
I want to call the Register command from my MFC MDI application.

I thought of a windows message.
How do I do it?
Is there any other better mechanism to do so?
Thanks,
Janiv Ratson.
 
If you know the class of the window on the tray application you can use
FindWindow() to get the window for the class. Then you can use either
PostMessage() or SendMessage() to send a message to that window. You should
be able to use the same message ID that is generated when you select the
functionality from the menu in the application. Basically, the tray
application will not know the difference between the message that came from
the outside or the one from its own menu.

Tom
 
Back
Top