Changing the Windows Wallpaper

How can I change the background Windows Wallpaper to a BMP file of my own choice in a Delphi Application ?

I would be grateful for all help offered regarding this.

John Clarke
johnclarkeAsked:
Who is Participating?
 
viktornetConnect With a Mentor Commented:
var
 i : integer;
begin
  SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, PChar('C:\WINDOWS\BUBBLES.BMP'), 0);
  i := FindWindowEx(FindWindowEx(FindWindow('Progman','Program
                   Manager'),0,'SHELLDLL_DefView', nil),0,'SysListView32',nil);
  PostMessage(i, WM_KEYDOWN,VK_F5,0);
  PostMessage(i, WM_KEYUP,VK_F5,2147483648);
end;

That should do it..

..-=ViKtOr=-..
0
 
retepCommented:
procedure TForm1.Button1Click(Sender: TObject);
Var
P : Pointer;
i : integer;
S: array[0..20] of Char;
begin
   StrPCopy(S,'MyBmp.bmp');//Convert Imagename to                                            Null-terminated string.
   P := @S;       //Pointer to Null-term. string
                           SystemParametersInfo(SPI_SETDESKWALLPAPER,0,P,1);
end;
0
 
retepCommented:
Woops sorry that it looks so messy. It looked fine before I posted it.

Hope you can decrypt it :-)

Let me know if that was what you were looking for...

Regards
retep

0
All Courses

From novice to tech pro — start learning today.