CodeItBetter Programming Another VB Programming Blog

How to Change the desktop wallpaper

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'System & API - How to Change the desktop wallpaper
'Use the SystemParametersInfo API function. If the final parameter is 
'SPIF_UPDATEINIFILE, the change is made permanently in the system INI file.
'If this parameter is 0, the wallpaper is temporary and not redisplayed the
'next time you boot.

Option Explicit
 
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 Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_UPDATEINIFILE = 1
 
Private Sub cmdSetWallpaper_Click()
    Dim upd As Integer
    If chkUpdateRegistry.Value = vbChecked Then
        upd = SPIF_UPDATEINIFILE
    Else
        upd = 0
    End If
    SystemParametersInfo SPI_SETDESKWALLPAPER, 0, txtFileName, upd
End Sub
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.