Jumat, 24 September 2010

Change Windows WallPaper with VB6

How to Change Windows WallPaper with VB6. This code shows you how to change set the wall paper for Windows, , put something like this in you *.bas file:

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
Public Const SPI_SETDESKWALLPAPER = 20
Public Const SPIF_UPDATEINIFILE = &H1


Then put something like this in a button or in the form_load:

' The final parameter "SPIF_UPDATEINIFILE" tells us to save the changes (so our new wallpaper is sill with us on restart).
' Setting this parameter to 0 will cause us not to update the registery and wont save the wallpaper.
Dim thePic As String
thePic = "C:\some_image.bmp"
Call SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, thePic, SPIF_UPDATEINIFILE)

Related Post :



0 comments:

R