17-10-12, 02:18 PM
كاتب الموضوع : Boutemine Oualid
كود :
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
' ' constants
Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_SENDWININICHANGE = &H2
Private Const SPIF_UPDATEINIFILE = &H1
Dim ctr As Integer
' Form contains a Command Button (cmddefaultwallpaper) and a Timer with
' seconds according to user choice.
' Please make sure that the path of the file to be changed is correct.
Private Sub cmddefaultwallpaper_Click()
ret = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "(None)", SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub
Private Sub Form_Load()
Form1.WindowState = 1
ctr = 0
'_________________________________
Dim ret As Long
Dim filename As String
ctr = ctr + 1
If ctr > 20 Then ctr = 1
' c:\photos folder holds bmp files from wall1.bmp to wall20.bmp.
filename = "c:\photos\wall" & ctr & ".bmp"
ret = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, filename, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub