Leaked source code of windows server 2003
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.

121 lines
2.5 KiB

  1. // Copyright (C) 1997 Microsoft Corporation
  2. //
  3. // Dialog to display promotion progress
  4. //
  5. // 12-29-97 sburns
  6. #ifndef PROGRESSDIALOG_HPP_INCLUDED
  7. #define PROGRESSDIALOG_HPP_INCLUDED
  8. class ProgressDialog : public Dialog
  9. {
  10. public:
  11. // one of these is returned from ModalExecute
  12. static const UINT THREAD_SUCCEEDED;
  13. static const UINT THREAD_FAILED;
  14. typedef void (*ThreadProc) (ProgressDialog& 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. ProgressDialog(
  22. ThreadProc threadProc,
  23. int animationResID);
  24. virtual ~ProgressDialog();
  25. // Restores the original animation that the dialog what created with.
  26. void
  27. RevertToOriginalAnimation();
  28. // Changes the animation AVI being shown in the dialog.
  29. //
  30. // animationResID - resource ID of the replacement AVI resource to be
  31. // played while the dialog is shown. This will replace the current
  32. // animation being shown.
  33. void
  34. UpdateAnimation(int newAnimationResId);
  35. void
  36. UpdateText(const String& message);
  37. void
  38. UpdateText(int textStringResID);
  39. void
  40. UpdateButton(const String& text);
  41. void
  42. UpdateButton(int textStringResID);
  43. enum WaitCode
  44. {
  45. PRESSED = 0,
  46. TIMEOUT = WAIT_TIMEOUT
  47. };
  48. // blocks calling thread until the button is pressed or the timeout
  49. // expires.
  50. WaitCode
  51. WaitForButton(int timeoutMillis);
  52. private:
  53. // Dialog overrides
  54. virtual
  55. void
  56. OnDestroy();
  57. virtual
  58. bool
  59. OnCommand(
  60. HWND windowFrom,
  61. unsigned controlIDFrom,
  62. unsigned code);
  63. virtual
  64. void
  65. OnInit();
  66. virtual
  67. bool
  68. OnMessage(
  69. UINT message,
  70. WPARAM wparam,
  71. LPARAM lparam);
  72. ThreadProc threadProc;
  73. int animationResId;
  74. struct WrapperThreadProcParams* threadParams;
  75. HANDLE buttonEventHandle;
  76. // not defined: no copying allowed
  77. ProgressDialog(const ProgressDialog&);
  78. const ProgressDialog& operator=(const ProgressDialog&);
  79. };
  80. #endif // PROGRESSDIALOG_HPP_INCLUDED