Author: William Gerbert
Respond to Windows messages
Answer:
Using WM_WININICHANGED as an example:
Declaring a method in a TForm will allow you to handle WM_WININICHANGED messages:
1 2 procedure WMWinIniChange(varmessage: TMessage);
3 message WM_WININICHANGE;
4 5 procedure TForm1.WMWinIniChange(varmessage: TMessage);
6 begin7 inherited;
8 {.. react to someone mucking with control panel ..}9 end;
The call to "inherited" is important. Note also that message handlers are special
when calling their inherited since you don't refer to the name of the inherited.
This is because the inherited is referring to the inherited message handler for this message number, which might not have a visible name or or even the same name as you have given it, or in some cases, might not even exist (in which case you are really calling DefaultHandler).