views:

409

answers:

1

I'm trying to find a way to change the theme of a Windows Mobile 5 device from within my software. Does anyone have any experience in this area?

Dylan

+2  A: 

You can set the relevant registry entries and then do a SendMessage to refresh the today screen.


  • HKEY_CURRENT_USER\Software\Microsoft\Today\Skin
  • HKEY_CURRENT_USER\Software\Microsoft\Today\UseStartImage
  • All values under HKEY_CURRENT_USER\Software\Microsoft\Today\(ThemeFileName)
  • HKEY_LOCAL_MACHINE\Software\Microsoft\Color\SHColor
  • HKEY_LOCAL_MACHINE\Software\Microsoft\Color\BaseHue
  • All values under HKEY_LOCAL_MACHINE\Software\Microsoft\Color\(ColorNumber)
  • HKEY_LOCAL_MACHINE\System\GWE\SysColor

C# code example:

using System.Runtime.InteropServices;
using Microsoft.Win32;
...
[DllImport("coredll.dll")]
private static extern int SendMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
...
public const int HWND_BROADCAST = 0xffff;
public const int WM_WININICHANGE = 0x001A;

// Copy wallpaper file to windows directory
File.Copy(@"\My Documents\My Pictures\ImageFileName.jpg", @"\Windows\stwater_240_240.jpg", true);                

// Update registry
Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Today", "Wall", "ImageFileName");

// Send message to refresh today screen
SendMessage((IntPtr)HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);

See more details at:

http://windowsmobiledn.com/qa-how-to-install-a-today-theme-file/

http://windowsmobiledn.com/forum/viewtopic.php?t=335

http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/83a0420b-1c8f-4201-b910-693b3b9a3b12

Kobus Smit
Kudos, this looks like the right answer to me.
TreeUK
None of the registry keys I can find on the windows mobile device.
Dylan Vester
I'm sorry, my bad, I found them :) Checking to see if it works now.
Dylan Vester
Hey man, sorry for the long delay. Your suggestions totally worked. However, changing the color key in the registry requires a soft reset (kind of a shame), but it's something I can live with. Thanks again! Accepted.
Dylan Vester
Well, actually it looks like I can't accept your response as an answer, there is no checkbox. Never seen that before. Voted up though.
Dylan Vester
Great stuff, will do this ASAP, ayobaness.
Marthinus