I need to know when my application receives a message WM_SETTINGCHANGE(formerly known as WM_WININICHANGE).
The problem is that the message pump in TApplication sends it through a black hole (default handler) before I can see it.
procedure TApplication.WndProc(var Message: TMessage);
...
begin
Message.Result := 0;
for I := 0 to FWindowHooks.Count - 1 do
if TWindowHook(FWindowHooks[I]^)(Message) then Exit;
CheckIniChange(Message);
with Message do
case Msg of
WM_SETTINGCHANGE:
begin
Mouse.SettingChanged(wParam);
Default; <----------------------*poof* down the sink hole
end;
...
end;
...
end;
The procedure CheckIniChange()does not generate any event that I can handle, and not Mouse.SettingChanged().
And as soon as the code path is reached Default, it goes down through the drain hole DefWindowProc, which will never be visible (since the first thing WndProc does is set Message.Resultto zero.
I was hoping to assign a handler to the TApplicationEvents.OnMessage event:
procedure TdmGlobal.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);
begin
case Msg.message of
WM_SETTINGCHANGE:
begin
// Code
end;
end;
end;
OnMessage , . WM_SETTINGCHANGE "",
PeekMessage
TranslateMessage
DispatchMessage
.
Windows WM_SETTINGCHANGE?