Home PostMessage for all instances of a specific form (ClassName):
Reply: 0

PostMessage for all instances of a specific form (ClassName):

user970
1#
user970 Published in April 26, 2018, 5:13 pm

In a VCL Forms program, I have a Form that implements a method for handling windows messages and updating some controls on the Form, something like:

procedure OnMsgTest (var Msg: TMessage); message WM_CUSTOMTEST;

I use PostMessage with a custom message to this Form, using a code like this:

  h := FindWindow('TFrmTest', nil);    
  if IsWindow(h) then begin    
    PostMessage(h, WM_CUSTOMTEST, 0, 0);    
  end;

When the Form is instantiated several times, using the above code to send the message, only one Form instance updates the information on the screen. I would like all open and instantiated Forms to receive the message.

An important note: PostMessage can occur within the Form process itself, but also from another process. So, I believe a loop through the Forms would not work.

What would be the best approach to reach my goal?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.326436 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO