Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Problems setting wallpaper

 

Hi, I've been writing a program to change the wallpaper, but it just won't work

 

Here's the code I've been using to set new wallpaper

 

  Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As String, ByVal fuWinIni As Long) As Long

  Const SPI_SETDESKWALLPAPER = 20
  Const SPIF_UPDATEINIFILE = &H1
  Const SPIF_SENDWININICHANGE = &H2

  Private Sub SetWallpaper()

      Dim lReturnVal as Long

      lReturnVal = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "C:\Temp\Test.bmp", SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
   End Sub

 

When SetWallpaper() is called (at a press of a button, atm), the whole desktop flickers but the wallpaper doesn't change, and no amount of refreshing will help.

 

Also, lReturnVal returns a non-zero character, and that means success (right?) so its obviously working, except it isn't.

 

Is there is anything I'm missing?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...