PDA

Click to See Complete Forum and Search --> : Set Window Wallpaper


May 1st, 2000, 12:11 AM
Hello,
Which API I should call in order to change window's Wallpaper? Thank!

May 1st, 2000, 03:52 AM
I don't know about API but if you ant, I could give you a code using the registry.

May 1st, 2000, 06:15 AM
The API to access the control panel elements is SystemParametersInfo.. u can retrieve and set almost anything in the control panel w/ this one... if ya want detailed code in vb on changin the wallpaper, just lemme know...

CiD -=ii=-

May 1st, 2000, 09:20 AM
Thank CiD. Please also give me detail of code on it, Thank a lot!!

May 1st, 2000, 03:31 PM
Sure, heres the code:

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 Const SPIF_SENDWININICHANGE = &H2

Private Sub cmdWallPaper_Click()
Dim rc As Long

rc = SystemParametersInfo(SPI_SETDESKWALLPAPER, _
0&, ByVal "C:\WINDOWS\MYBMP.BMP", _
SPIF_UPDATEINIFILE Or _
SPIF_SENDWININICHANGE)

End Sub
The parameters passed r:

uAction - param to retrieve or set, its a constant in the API viewer that starts w/ SPI_

uParam - value depends on action, or if retrieving set it to 0

lpvParam - the value to be set, or returns setting when uParam is set to 0

fuWinIni - changes to make to the win.ini (UPDATEINIFILE saves the settings to the user's profile. SENDWININICHANGE broadcasts a system change to all other apps.)

Hope this helps..

CiD -=ii=-

May 1st, 2000, 04:27 PM
Thank, CiD