In the VCL Forms program, I have a Form that implements a method for processing Windows messages and updating some form controls, for example:
procedure OnMsgTest (var Msg: TMessage); message WM_CUSTOMTEST;
I use PostMessage
with a custom post to this form using this code:
h := FindWindow('TFrmTest', nil);
if IsWindow(h) then begin
PostMessage(h, WM_CUSTOMTEST, 0, 0);
end;
When a Form instance is created several times using the above code to send a message, only one Form instance updates the information on the screen. I would like all open and created instances of forms to receive a message.
An important note: it PostMessage
may arise in the Form process itself, but also from another process. So, I believe that the cycle through Forms will not work.
What will be the best approach to achieve my goal?