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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
viktornetCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.