- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Broadcasting a message.

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;



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile