A simple trick for forcing the today screen to re-read from the registry (or refresh) is by sending the message WM_WININICHANGE with the parameter 0x000000F2 to a window called the DesktopExplorerWindow.
Here's a small code snippet on how to accomplish this programmatically:
void RefreshTodayScreen() {
HWND hWnd = FindWindow(_T("DesktopExplorerWindow"), _T("Desktop"));
SendMessage(hWnd, WM_WININICHANGE, 0x000000F2, 0);
}
and in managed code...
[DllImport("coredll.dll")]
static extern IntPtr FindWindow(string class_name, string caption);
[DllImport("coredll.dll")]
static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
const uint WM_WININICHANGE = 0x1a;
void RefreshTodayScreen() {
IntPtr hWnd = FindWindow("DesktopExplorerWindow", "Desktop");
SendMessage(hWnd, WM_WININICHANGE, 0x000000F2, 0);
}
Subscribe to:
Post Comments (Atom)
2 comments:
Hi Christian,
Is there a simillar technique to refreshing the HomeScreen/ Plugin in a Wibdows Mobile 5 Home screen?
The code should actually work on WM5
Post a Comment