Code: Select all
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private-Deklarationen }
function HookMainWindow(var Message: TMessage): Boolean;
public
{ Public-Deklarationen }
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.HookMainWindow(HookMainWindow);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Application.UnhookMainWindow(HookMainWindow);
end;
function TForm1.HookMainWindow(var Message: TMessage): Boolean;
const
WM_SETTINGCHANGE_OFFSET = 8 * WM_USER;
begin
Result := False;
if WM_SETTINGCHANGE = Message.Msg then
begin
case Message.WParam of
// Add the setting flag here that triggered the flickering.
0, 1, SPI_SETMOUSETRAILS, SPI_SETMOUSE, SPI_SETMOUSESPEED:
begin
// Do not eat the message, instead hide it from the normal handling by adding
// an offset. That way it remains possible to catch those messages by the
// normal message handler methods.
Inc(Message.Msg, WM_SETTINGCHANGE_OFFSET);
end;
end;
end;
end;