Try this sample from www.allapi.net:
VB Code:
'This project needs
'- a common dialog box
' (To add the Common Dialog Box to your tools menu, go to Project->Components (or press CTRL-T)
' and select Microsoft Common Dialog control)
'- a command button
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_UPDATEINIFILE = &H1
Private Sub Command1_Click()
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
'Set the commondialogbox' title
CommonDialog1.DialogTitle = "Choose a bitmap"
'Set the filter
CommonDialog1.Filter = "Windows Bitmaps (*.BMP)|*.bmp|All Files (*.*)|*.*"
'Show the 'Open File'-dialog
CommonDialog1.ShowOpen
'Change the desktop's background
SystemParametersInfo SPI_SETDESKWALLPAPER, 0, CommonDialog1.FileName, SPIF_UPDATEINIFILE
End Sub
Private Sub Form_Load()
Command1.Caption = "Set Wallpaper"
End Sub