Problems setting wallpaper (VB)

Meanie

Newcomer
Joined
Jan 4, 2003
Messages
23
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

Code:
   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?
 
Back
Top