Главная страница | назад





Article #17426: Broadcasting a message.

 Question and Answer Database

FAQ2426D.txt   Broadcasting a message.
Category   :Windows API
Platform    :All
Product    :All 32 bit  

Question:
How do I broadcast a message (such as WM_WININICHANGE) 
to all top level Windows?


Answer:
The Windows API function SendMessage()  takes a 4 
parameters. The first is the window handle. To broadcast 
to all top level Windows, use HWND_BROADCAST. The second 
parameter is the message itself, and then the WParam and 
the LParam parameters for the given message. For the 
WM_WININICHANGE message, wParam should be zero, and LParam 
should be either the address of a null terminated section 
name that changed, or nil if you want each window to examine 
all sections for the change. Passing a null value is not 
recommended unless you have modified several sections due 
to performance considerations.

Example:

var
   s : array[0..64] of char;
begin
    StrCopy(S, 'windows');
    SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, LongInt(@S));
end;

7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99