Link to home
Start Free TrialLog in
Avatar of ammotroop
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
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Are you asking how to get the values for SPI_GETDESKWALLPAPER?  Or, are you asking what type of value do you get back?

Bob
Avatar of ammotroop
ammotroop

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_GETDESKWALLPAPER, vbNull, oldWallpaper, vbNull)

        If oldWallpaper.Length > 0 Then
            SystemParametersInfo(SPI_GETDESKWALLPAPER, 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
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The value is stored in the registry here:

HKEY_CURRENT_USER\Control Panel\Desktop\ConvertedWallpaper

Bob
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
It wouldn't work until I changed to the Unicode version--SystemParametersInfoW.

Bob