How to use SendMessage to another form in same app
Posted
by Robert Frank
on Stack Overflow
See other posts from Stack Overflow
or by Robert Frank
Published on 2010-05-23T00:04:54Z
Indexed on
2010/05/23
0:10 UTC
Read the original article
Hit count: 308
delphi
I've been trying to get this to work for some time now and can't figure it out. Probably obvious once you know it.
I simply want a non-modal form (or perhaps an instantiated non-TForm class) to send a message to the application's main form.
I can make the main form send a message to itself and receive (announcing with a beep)
But, I can't seem to have other objects send messages to the main form.
I'm using WM_MY_MESSAGE = WM_APP + 200;
What should the first argument of the SendMessage be to send a message to the main form? Even sending it to Application.MainForm.Handle doesn't seem to work.
The reason I need to do this is that the modal form has a slider that another form (#2) needs to know when it changes. Notifying the other form via a callback procedure was making it sluggish as form #2 did some work before returning from the call. Is having a modal form send a windows message to the main form a reasonable way to avoid this?
© Stack Overflow or respective owner