Programmatically Refreshing the Today Screen
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);
}