1 #ifndef __UNIVERSALPROGRESSDIALOG_H_A0B4F977__97BA__43c0__83A2__6B64410E92E2
2 #define __UNIVERSALPROGRESSDIALOG_H_A0B4F977__97BA__43c0__83A2__6B64410E92E2
5 #include "InitCommonControls.h"
7 #define CUPDIALOG_CONTROL_CLASSES (ICC_PROGRESS_CLASS) //We are using Progress bar Control
11 typedef bool (*LP_CUPDIALOG_USERPROC)(
const CUPDUPDATA*);
22 LPVOID pUserProcParam;
26 LP_CUPDIALOG_USERPROC m_lpUserProc;
30 WM_DISABLECONTROLS = (WM_USER+1234),
32 WM_PROGRESSTHREADCOMPLETED,
34 WM_PROGRESSTEXTUPDATE,
35 WM_CANCELPROGRESSTHREAD
50 inline LPVOID GetAppData()
const {
return this->pUserProcParam; }
53 inline bool ShouldTerminate()
const {
return this->bTerminate; }
56 inline void SetProgress(LPCTSTR lpszProgressText)
const
58 if(::IsWindow(this->hThreadWnd) && this->bTerminate ==
false)
59 ::SendMessage(this->hThreadWnd,_ProgressThreadData::WM_PROGRESSTEXTUPDATE,0,(LPARAM)lpszProgressText);
62 inline void SetProgress(UINT_PTR dwProgressbarPos)
const
64 if(::IsWindow(this->hThreadWnd) && this->bTerminate ==
false)
65 ::SendMessage(this->hThreadWnd,_ProgressThreadData::WM_PROGRESSBARUPDATE,dwProgressbarPos,0);
68 inline void SetProgress(LPCTSTR lpszProgressText,UINT_PTR dwProgressbarPos)
const
70 SetProgress(lpszProgressText);
71 SetProgress(dwProgressbarPos);
76 inline void AllowCancel(
bool bAllow)
const
78 if(::IsWindow(this->hThreadWnd) && this->bTerminate ==
false)
79 ::SendMessage(this->hThreadWnd,bAllow?_ProgressThreadData::WM_ENABLECONTROLS:_ProgressThreadData::WM_DISABLECONTROLS,0,0);
82 inline void SetDialogCaption(LPCTSTR lpszDialogCaption)
const
84 if(::IsWindow(this->hThreadWnd) && this->bTerminate ==
false)
85 ::SendMessage(this->hThreadWnd,WM_SETTEXT,0,(LPARAM)lpszDialogCaption);
96 LPCTSTR m_lpszTemplateName;
98 int m_nStaticControlId;
100 int m_nProgressBarControlId;
102 int m_nCancelButtonId;
104 DWORD m_dwTerminateDelay;
110 TCHAR m_szDialogCaption[256];
114 friend INT_PTR CALLBACK ProgressDlgProc(HWND,UINT,WPARAM,LPARAM);
125 CUPDialog(HWND hParentWnd,LP_CUPDIALOG_USERPROC lpUserProc,LPVOID lpUserProcParam,LPCTSTR lpszDlgTitle=_T(
"Please Wait.."),
bool bAllowCancel=
true);
134 inline void SetDialogTemplate(HINSTANCE hInst, LPCTSTR lpTemplateName,
int StaticControlId,
int ProgressBarControlId,
int CancelButtonId)
138 m_lpszTemplateName = lpTemplateName;
140 m_nStaticControlId = StaticControlId;
142 m_nProgressBarControlId = ProgressBarControlId;
144 m_nCancelButtonId = CancelButtonId;
150 inline void SetTerminationDelay(DWORD dwMilliSeconds)
152 m_dwTerminateDelay = dwMilliSeconds;
173 virtual INT_PTR OnMessage(HWND hDlg,UINT Message,WPARAM wParam,LPARAM lParam, BOOL bProcessed)