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

  • : 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.

  • 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!

  • : 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.
  • Thank you!
Sign In or Register to comment.

Howdy, Stranger!

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

Categories