Change Wallpaper

'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Add 1 Command Button to your form.
'Insert the following code to your 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

'Insert the following code to your form:

Private Sub Command1_Click()
Dim t As Long
Dim Wallpaper As String
'Replace 'c:\MyFile.bmp' with the name of your BMP File.
Wallpaper = "c:\MyFile.bmp"
t = SystemParametersInfo(ByVal 20, vbnostring, ByVal Wallpaper, &H1)
If t = 0 Then
MsgBox "Error changing wallpaper"
Exit Sub
End If
End Sub

Go Back