is it possible to change the desktops background with vb6, and how?
Printable View
is it possible to change the desktops background with vb6, and how?
Happy B'Day :wave:
Two beautiful ways to achieve what you want...
http://www.freevbcode.com/ShowCode.asp?ID=5489
http://www.vb-helper.com/howto_backer.html
You can use the SystemParametersInfo API function. The first parameter is set to 20, the second parameter is set to 0, the third parameter is the path and filename of your bitmap image and the final parameter is set to 0 if you don't want the changes to survive a reboot and 1 if you do.
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
Private Sub ChangeWallpaper(BMPfilename As String, UpdateRegistry As Boolean)
On Error GoTo MyErr
If UpdateRegistry Then
SystemParametersInfo 20, 0, BMPfilename, 1
Else
SystemParametersInfo 20, 0, BMPfilename, 0
End If
Exit Sub
MyErr:
MsgBox "oops... " & Err.Description
End Sub
Private Sub Command1_Click()
' This won't survive a reboot
ChangeWallpaper App.Path & "\wallpaper.bmp", False
End Sub
Private Sub Command2_Click()
' This will permanently change the wallpaper
ChangeWallpaper App.Path & "\wallpaper.bmp", True
End Sub
i like how you can choose wether it should be permenant or not :D thanks works.