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

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.
 
T

Tom Serface

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top