Problems setting wallpaper (VB)

Meanie

Member
Joined
Jan 4, 2003
Messages
23
Problems setting wallpaper

Hi, Ive been writing a program to change the wallpaper, but it just wont work

Heres the code Ive 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 doesnt 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 isnt.

Is there is anything Im missing?
 
Try changing all Long parameters in your declare to Integers, see if that helps.
 

Similar threads

S
Replies
0
Views
76
Semicolin
S
J
Replies
0
Views
112
JenCarlos
J
V
Replies
0
Views
60
VaecorsDraconem
V
H
Replies
0
Views
56
HanneSThEGreaT
H
Back
Top