ammotroop
asked on
SystemParametersInfo Values
Experts,
I have seen a million and 1 options for the SystemParametersInfo values. Mainly the values like SPI_SETDESKWALLPAPER. Now, here is what I am wondering. What exactly are these values. I need to be able to get the current desktop wallpaper and match it against a value that is stored in the registry. I know how to do the matching and are basically wondering what the values are for SPI_GETDESKWALLPAPER. and any other value that I might need to get/update/set the desktop wallpaper. Any help is greatly appreciated.
Jason
I have seen a million and 1 options for the SystemParametersInfo values. Mainly the values like SPI_SETDESKWALLPAPER. Now, here is what I am wondering. What exactly are these values. I need to be able to get the current desktop wallpaper and match it against a value that is stored in the registry. I know how to do the matching and are basically wondering what the values are for SPI_GETDESKWALLPAPER. and any other value that I might need to get/update/set the desktop wallpaper. Any help is greatly appreciated.
Jason
ASKER
Well I was originally asking about the value of SPI_GETDESKWALLPAPER, but I finally found that value. However, now I am having trouble getting SystemParametersInfo to work. I think it is going to be like the GetUserObjectInformation API where you have to call it twice but even when I do that I get a blank message box. So if you know of an answer that would be great. Here is what I got so far.
Public Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Int32, ByRef lpvParam As System.Text.StringBuilder, ByVal fuWinIni As Integer) As Integer
Dim oldWallpaper As New System.Text.StringBuilder
SystemParametersInfo(SPI_G ETDESKWALL PAPER, vbNull, oldWallpaper, vbNull)
If oldWallpaper.Length > 0 Then
SystemParametersInfo(SPI_G ETDESKWALL PAPER, oldWallpaper.Length, oldWallpaper, vbNull)
End If
MsgBox(oldWallpaper)
Maybe I am going about this the wrong way. This is the first time I have actually had to deal with API's and quit frankly are learning a lot.
Jason
Public Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Int32, ByRef lpvParam As System.Text.StringBuilder,
Dim oldWallpaper As New System.Text.StringBuilder
SystemParametersInfo(SPI_G
If oldWallpaper.Length > 0 Then
SystemParametersInfo(SPI_G
End If
MsgBox(oldWallpaper)
Maybe I am going about this the wrong way. This is the first time I have actually had to deal with API's and quit frankly are learning a lot.
Jason
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The value is stored in the registry here:
HKEY_CURRENT_USER\Control Panel\Desktop\ConvertedWal lpaper
Bob
HKEY_CURRENT_USER\Control Panel\Desktop\ConvertedWal
Bob
ASKER
Bob,
I knew where it was stored and the class that you posted helped a lot. I used ByRef lpvParam instead of ByVal. Wondered why the dang thing was not working. As soon as I changed it voila. Thanks again.
Jason
I knew where it was stored and the class that you posted helped a lot. I used ByRef lpvParam instead of ByVal. Wondered why the dang thing was not working. As soon as I changed it voila. Thanks again.
Jason
It wouldn't work until I changed to the Unicode version--SystemParametersI nfoW.
Bob
Bob
Bob