Di bawah ini merupakan fungsi VB6 untuk merubah desktop wallpaper. Bagaimana implementasinya dalam Visual Basic 6.0?
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 SPIF_SENDWININICHANGE = &H2
Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPIF_SETDESKWALLPAPER = 20
Public Function ChangeWallPaper(imgFile As String)
Call SystemParametersInfo(SPIF_SETDESKWALLPAPER, 0&, imgFile, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Function
Contoh penggunaan kode di atas
Private Sub Command1_Click()
Call ChangeWallPaper("C:\Windows\Blue.bmp")
End Sub