=================================
/* Initializing the dialog */
INITCOMMONCONTROLSEX InitCtrlEx;
InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
InitCtrlEx.dwICC = ICC_PROGRESS_CLASS;
InitCommonControlsEx(&InitCtrlEx);
HWND hProgressWnd = CreateDialogParam(hInstance,
MAKEINTRESOURCE(IDD_PROGRESS), GetTopWindow(0),
(DLGPROC)ProgressDlgProc, NULL);
ShowWindow(hProgressWnd, SW_SHOWNORMAL);
UpdateWindow(hProgressWnd);
=================================
/* Window proc */
BOOL CALLBACK ProgressDlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam,
LPARAM lParam) {
switch(Msg) {
case WM_INITDIALOG:
SendDlgItemMessage(hWndDlg, IDC_PROGRESS, PBM_SETSTEP, (WPARAM)
1, 0);
SendDlgItemMessage(hWndDlg, IDC_PROGRESS, PBM_SETRANGE, 0,
MAKELPARAM(0, 5));
return TRUE;
case WM_COMMAND:
switch(wParam) {
case IDOK:
EndDialog(hWndDlg, 0);
return TRUE;
}
break;
}
return FALSE;
}
=================================
/* How the dialog is updated */
SendDlgItemMessage(hProgressWnd, IDC_PROGRESS, PBM_STEPIT, 0, 0);
UpdateWindow(hProgressWnd);
=================================
-Gregg
Thank you very much to Raymond Chen who got me thinking about it with
his blog entry on GetDesktopWindow():
http://blogs.msdn.com/oldnewthing/archive/2004/02/24/79212.aspx
Yes Virginia, there is a Santa Claus - his name is Chen!
-Gregg