Change Desktop wallpaper
By: Lorenzo Dalla Vecchia Date: 28/08/1997

Through the use of API you can easily change Windows Desktop wallpaper.
Start with adding the following declaration to the Declarations section of a module:

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

It is then vary simple to change the wallpaper:

Dim t As Long
t = SystemParametersInfo(ByVal 20, Empty, ByVal filename, &H1)

Just replace filename with the path of the image file to use (for example "C:\Windows\Plus!.Bmp").
Note: if an error occours while changing the wallpaper (
i.e. file not found), t will be 0.

Click Here!

Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
To contact the Webmaster, click here.
Hosted by InWind: