How to change the desktop wallpaper? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to change the desktop wallpaper?

Hi! According to the windows SDK help file, I use the following command to change the wall paper. I traced it and made sure the file 'c:Vinca.jpg' exists, but after running it, the wall paper doesn't change(still no wall paper).

Can you tell me how to change it?

Thank you!

[code]
if FileExists('c:Vinca.jpg') then
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0,
PChar('c:Vinca.jpg'), 0);
[/code]

Comments

  • pak77pak77 Posts: 28Member
    : Hi! According to the windows SDK help file, I use the following command to change the wall paper. I traced it and made sure the file 'c:Vinca.jpg' exists, but after running it, the wall paper doesn't change(still no wall paper).
    :
    : Can you tell me how to change it?
    :
    : Thank you!
    :
    : [code]
    : if FileExists('c:Vinca.jpg') then
    : SystemParametersInfo(SPI_SETDESKWALLPAPER, 0,
    : PChar('c:Vinca.jpg'), 0);
    : [/code]
    :
    Hi, the reason the wallpaper doesn't change is that the wallpaper image has to be in "bmp" format and not a "jpg" image.

  • earth_walkerearth_walker Posts: 184Member
    Thank you! I use a .bmp file and change the wallpaper successfully.

    I got a further question is that why it cannot be .jpg? Because I tried to select a .jpg file in "Windows Display Properities" run by right clicking desktop, and it still works.

    Thank you!

  • ManningManning Posts: 1,621Member
    : Thank you! I use a .bmp file and change the wallpaper successfully.
    :
    : I got a further question is that why it cannot be .jpg? Because I tried to select a .jpg file in "Windows Display Properities" run by right clicking desktop, and it still works.

    It can be .jpg, but it is much more complicated. The simple solution is to take the .jpg and convert it to a .bmp, and then set it as the wallpaper. But if you want to learn how to do it the other way, it was recently discussed on the C++ programming board so you could take a look there.
  • earth_walkerearth_walker Posts: 184Member
    Thank you!
Sign In or Register to comment.