Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

162 lines
2.7 KiB

  1. // Copyright (C) 2001 Microsoft Corporation
  2. //
  3. // Dialog to display promotion progress
  4. //
  5. // April-2000 hiteshr created, ported from
  6. // sburns dcpromo implementation
  7. #ifndef CProgressDialog_HPP_INCLUDED
  8. #define CProgressDialog_HPP_INCLUDED
  9. #define THREAD_SUCCEEDED WM_APP + 9
  10. #define THREAD_FAILED WM_APP+ 10
  11. class CProgressDialog : public CDlg
  12. {
  13. public:
  14. typedef HRESULT (*ThreadProc) (CProgressDialog& dialog);
  15. // threadProc - pointer to a thread procedure that will be started when
  16. // the dialog is initialized (OnInit). The procedure will be passed a
  17. // pointer to this instance.
  18. //
  19. // animationResID - resource ID of the AVI resource to be played while
  20. // the dialog is shown.
  21. CProgressDialog(ThreadProc ThreadProc,
  22. int iAnimationResId,
  23. DWORD dwWaitTime,
  24. CRow * pRow,
  25. ULONG flProcess,
  26. BOOL bXForest,
  27. const CObjectPicker &rop,
  28. const CScope &Scope,
  29. const String &strUserEnteredString,
  30. CDsObjectList *pdsolMatches);
  31. virtual ~CProgressDialog();
  32. HRESULT
  33. CreateProgressDialog(HWND hwndParent);
  34. //
  35. //To be called by worker thread when its done
  36. //
  37. HRESULT
  38. ThreadDone();
  39. void
  40. UpdateText(const String& message);
  41. BOOL HasUserCancelled(){ return m_bStop; }
  42. CRow * m_pRow;
  43. ULONG m_flProcess;
  44. BOOL m_bXForest;
  45. const CObjectPicker &m_rop;
  46. const CScope &m_Scope;
  47. const String &m_strUserEnteredString;
  48. CDsObjectList *m_pdsolMatches;
  49. private:
  50. HRESULT
  51. CProgressDialog::CreateThread();
  52. // Dialog overrides
  53. //
  54. //Handles messages specific to Progress Dialog
  55. //
  56. virtual
  57. BOOL
  58. OnProgressMessage(UINT uMsg,
  59. WPARAM wParam,
  60. LPARAM lParam);
  61. virtual
  62. BOOL
  63. _OnCommand(WPARAM wParam,
  64. LPARAM lParam);
  65. virtual
  66. HRESULT
  67. _OnInit(BOOL *pfSetFocus);
  68. virtual
  69. void
  70. DoModalDlg(HWND hwndParent)
  71. {
  72. _DoModalDlg(hwndParent, IDD_PROGRESS);
  73. }
  74. //
  75. //Handle to the worker thread
  76. //
  77. HANDLE m_hThread;
  78. //
  79. //Worker thread procedure
  80. //
  81. ThreadProc m_ThreadProc;
  82. //
  83. //Structure passed in CreateThread
  84. //
  85. struct Wrapper_ThreadProcParams* m_pThreadParams;
  86. //
  87. //Resource ID of the AVI resource to be played while
  88. //the dialog is shown.
  89. //
  90. int m_iAnimationResId;
  91. //
  92. //Wait time before showing the dialog box
  93. //
  94. DWORD m_dwWaitTime;
  95. //
  96. //If user has pressed Stop button
  97. //
  98. BOOL m_bStop;
  99. //
  100. //This event is signaled when worker thread is done
  101. //
  102. HANDLE m_hWorkerThreadEvent;
  103. //
  104. //Used for Synchronization purpose
  105. //
  106. HANDLE m_hSemaphore;
  107. //
  108. //Not defined: no copying allowed
  109. CProgressDialog(const CProgressDialog&);
  110. const CProgressDialog& operator=(const CProgressDialog&);
  111. };
  112. #endif // CProgressDialog_HPP_INCLUDED