Respond to Windows messages (Views: 100)


Respond to Windows messages


Using WM_WININICHANGED as an example:

Declaring a method in a TForm will allow you to handle WM_WININICHANGED messages:

procedure WMWinIniChange(var message: TMessage);

procedure TForm1.WMWinIniChange(var message: TMessage);
  {.. react to someone mucking with control panel ..}

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).

<< Back to main page