Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing the Windows Wallpaper from VB
Message
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00102308
Message ID:
00102473
Views:
24
>How can I change the wallpaper of Windows using VB 5.0.
>
>I found the "Wallpaper" setting in the "Desktop" entry of the registry, I change it to a new value (a valid one).
>
>Then, when I look in the control panel, the wallpaper is changed but the desktop isn't.
>
>Anybody have an idea?


Stop searching everybody, I found it and I would like to give to you...

Simply adding this calls to the Windows API:

Option Explicit

Private Declare Function SystemParametersInfo _
Lib "user32" _
Alias "SystemParametersInfoA" _
(ByVal uAction As Long, _
ByVal uParam As Long, _
ByVal lpvParam As Any, _
ByVal fuWinIni As Long _
) As Long
Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_SENDWININICHANGE = &H2

Private Sub Form_Load()
Dim lngReturn As Long

lngReturn = SystemParametersInfo(SPI_SETDESKWALLPAPER, _
0, _
"c:\Windows\Clouds.bmp", _
SPIF_SENDWININICHANGE)
End Sub
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Reply
Map
View

Click here to load this message in the networking platform