Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do a global SendMessage to many windows in app?

Status
Not open for further replies.

LucieLastic

Programmer
May 9, 2001
1,694
GB
hi

I have several instances of a form open at the same time and I'd like to do a global SendMessage to all of them (to trigger a refresh) but don't know the Window handles of them, is it possible? Or will I have to start storing what windows are open and loop thru the list?

lou
 
I'm thinking of using EnumWindows (just reading about it) but is there any other way?
 
Doh, can't get HWND_BROADCAST to work. I need to broadcast to child forms in the app. Help needed, if anyone has an example ...

lou [ponder]
 
hi Lou,

I'm using this code:

for w := 0 to Application.ComponentCount-1 do
if (Application.Components[w] is TForm) then
PostMessage((Application.Components[w] as TForm).Handle, .., .., ..);


regards
Rod
 
Thanks Rod.

I've changed my app slightly to store the current handles of the windows open in a Tlist. Thanks for the suggestion though, I didn't think of using 'Application.' - I'm half a sleep today. I may use your suggestion as at the mo. I'm having to maintain the list myself when windows are opened and closed.

thanks again
lou
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top