Page 1 of 1

TC flickering when changing Windows desktop background wallpaper (+fix)

Posted: 2022-12-01, 11:09 UTC
by Erik-DJ
When changing the Windows desktop background wallpaper (photo/image), TC starts to flicker for about a second or two. It's annoying because I have an automatic background changer every few hours. You can fix this in Delphi with the following code (from https://www.heidisql.com/forum.php?t=19141&cookie_consent=1):

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;
Thanks. Windows 10 pro x64. Darkmode TC x64 v10.52.

Re: TC flickering when changing Windows desktop background wallpaper (+fix)

Posted: 2022-12-01, 17:10 UTC
by Horst.Epp
Its not a real problem for most users.
I guess your suggestion doesn't help as x64 TC is not written in Delphi

Re: TC flickering when changing Windows desktop background wallpaper (+fix)

Posted: 2022-12-01, 18:46 UTC
by Sir_SiLvA
Horst.Epp wrote: 2022-12-01, 17:10 UTC I guess your suggestion doesn't help as x64 TC is not written in Delphi
AFAIK it IS as "Lazarus is a Delphi compatible cross-platform IDE for Rapid Application Development".

Re: TC flickering when changing Windows desktop background wallpaper (+fix)

Posted: 2022-12-02, 00:03 UTC
by Fla$her
Erik-DJ wrote: 2022-12-01, 11:09 UTCWhen changing the Windows desktop background wallpaper (photo/image), TC starts to flicker for about a second or two.
I often use the wallpaper changer script, I've never noticed this. Checked on 10.52 x32/x64, there is no flicker.