[RESOLVED] Changing Windows CE 5.0 desktop wallpaper
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:
Code:
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
Re: Changing Windows CE 5.0 desktop wallpaper
There is a solution posted here - should be easy enought to translate.
Re: Changing Windows CE 5.0 desktop wallpaper
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:
Code:
Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\ControlPanel\Desktop\", "wallpaper", "\Windows\wallpaper.bmp")
I then tried calling
Code:
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
Code:
Microsoft.WindowsCE.Forms.SystemSettings.ScreenOrientation = Microsoft.WindowsCE.Forms.ScreenOrientation.Angle180
after the registry change, it refreshes the desktop and my wallpaper appears :)
Thanks!