PDA

Click to See Complete Forum and Search --> : [RESOLVED] Changing Windows CE 5.0 desktop wallpaper


PaxPsychosis
Feb 9th, 2009, 07:57 AM
Hi,

I'm looking for a way to change the desktop wallpaper on Windows CE from Visual Basic 2005. After a lot of digging, the only solution I've found is shown below, but it doesn't work:


Public Declare Function SystemParametersInfo Lib "Coredll.dll" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer

Public Const SPI_SETDESKWALLPAPER As System.UInt32 = &H14
Public Const SPIF_UPDATEINIFILE As System.UInt32 = &H1
Public Const SPIF_SENDWININICHANGE As System.UInt32 = &H2



Sub Main()

SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "\Windows\wallpaper.bmp", SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)

End Sub



SystemParametersInfo returns 0. I've tried setting the wallpaper to "(None)" and that has the same result. The "wallpaper.bmp" file exists, and I'm able to set the wallpaper to that manually on the device. I'm aware that SystemParametersInfo seems to only work with bmp files, but that won't be an issue if I can just get it working.. or is there an alternative method?

Thanks

petevick
Feb 9th, 2009, 08:53 AM
There is a solution posted here (http://www.eggheadcafe.com/software/aspnet/30347794/changing-pocketpc-wallpap.aspx) - should be easy enought to translate.

PaxPsychosis
Feb 10th, 2009, 04:56 AM
Hi,

Thanks for the response.. although that wasn't quite what I was after, it did get me thinking about the registry, and the solution was actually very similar. I changed the wallpaper in the registry as follows:

Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\ControlPanel\Desktop\", "wallpaper", "\Windows\wallpaper.bmp")

I then tried calling

SendMessage(HWND_BROADCAST, WM_WININICHANGE, &HF2, 0)

But that didn't work unfortunately. As it happens though, this program also needs to change the orientation of the screen, and by calling

Microsoft.WindowsCE.Forms.SystemSettings.ScreenOrientation = Microsoft.WindowsCE.Forms.ScreenOrientation.Angle180


after the registry change, it refreshes the desktop and my wallpaper appears :)

Thanks!