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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I send a message to my MDI-child windows 1

Status
Not open for further replies.

TimSNL

Programmer
Sep 11, 2001
119
AU
Hello,

My application has many MDI windows that may be opened during use.

Is there a way to somehow broadcast a message from the MDI-parent (in a generic way) that all the MDI-child windows can act on if required?

I have not used any type of window messaging before so any hints to point me in the right directin would be appriciated.

Thanks for your help :)
(Replies to my last post were very helpful, thankyou everyone)

Tim
SNL Computing
 
For broadcasting you can use PostMessage(HWND_BROADCAST, WM_MY_MESSAGE, wParam, lParam). That message would be recieved by ALL windows. And if you want to send message to your MDI child forms only then you can do it like :
Code:
procedure SomeProc(Sender : TObject);
var
  i : Integer;
begin
  for i := 0 to Self.MDIChildCount - 1 do
   PostMessage(Self.MDIChildren[i].Handle, WM_MY_MESSAGE, wParam, lParam);
end;

--- markus
 
Thankyou for your help :)

[infinity] To extend this question ...
Is it possible to send these messages out to all computers on my LAN?

Tim
 
If you mean WM_ messages then answer is no. Here i have a small client program that allows users to launch my applications, it also checks for updated on server before launching anything AND it recieved commands from server application via socket connection. So when i need to send a WM_ message to clients i send an appropriate command to my loader applications on client computers and it broacasts it on local machine.

--- markus
 
PostMessage is working fine if I give it a HWND.
If I try to use the HWND_BROADCAST the message does not seem to make it into the WndProc of my other applications I have running?
Can you email me a sample of code where you have this working? (tim @ snlcomputing .com .au)

Thanks.
Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top