PDA

Click to See Complete Forum and Search --> : wallpaper


HeSaidJoe
Dec 15th, 1999, 06:46 PM
trying to change wallpaper in windows
Ihave my module which has 2 api calls
one for win path the other for systemparametersinfo
SPI_SETDESKWALLPAPER = 20

I have set the path Rivetspath & point to a bmp in the windsows file Rivets.bmp

I understand things up to here...

retval = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, ByVal Rivetspath, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE)

================================
here is what I don't understand

What are SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE)

Do I have to make declares for these?
Do I have to do anything for these?

I msgbox for display and I get the correct path and retval=1 but that is it..no change.

Serge
Dec 15th, 1999, 07:31 PM
The last parameter in your API call tells windows to update a Win.ini (using these 2 constants SPIF_SENDWININICHANGE and SPIF_UPDATEINIFILE) with the new path of your wallparper.

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)

HeSaidJoe
Dec 15th, 1999, 07:46 PM
Serge: that means I don't they are just do their thing?
Here is the code I have so far but it does nothing....help!

'module code

Public Declare Function GetWindowsDirectory _
Lib "kernel32" Alias "GetWindowsDirectoryA" _
(ByVal lpBuffer As String, ByVal nSize As Long) As Long

Public Const SPI_SETDESKWALLPAPER = 20

'form event code

' Set the desktop wallpaper to the Rivets.bmp that comes with Windows.
' Note how the string passed to the function is preceeded by the ByVal keyword.
Dim windir As String ' receives the path of the Windows directory
Dim Rivetspath As String ' filename of rivets.bmp
Dim retval As Long ' return value

' Get the path of the Windows directory.
windir = Space(255) ' make room in the buffer
retval = GetWindowsDirectory(windir, 255) ' get the path name
windir = Left(windir, InStr(windir, vbNullChar) - 1) ' trim the null character and unused characters
Rivetspath = windir & "\" & "Rivets.bmp" ' add the filename to the path
' Set the Windows wallpaper, saving the change and notifying all programs
retval = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, ByVal Rivetspath, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE)

Serge
Dec 15th, 1999, 08:06 PM
Yes, it tells that when the system changes the wallpaper, it also changes the Win.INI file, so the next time windows start, this wallpaper would be loaded as well. And yes, it doesn't have to be handled yourself.

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)

HeSaidJoe
Dec 15th, 1999, 08:49 PM
It should..but it does nothing..anyone have time to try it on their machine.

I use vb6 win98

Thanks,
Wayne