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.

101 lines
1.9 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. void
  26. UpdateText(const String& message);
  27. void
  28. UpdateText(int textStringResID);
  29. void
  30. UpdateButton(const String& text);
  31. void
  32. UpdateButton(int textStringResID);
  33. enum WaitCode
  34. {
  35. PRESSED = 0,
  36. TIMEOUT = WAIT_TIMEOUT
  37. };
  38. // blocks calling thread until the button is pressed or the timeout
  39. // expires.
  40. WaitCode
  41. WaitForButton(int timeoutMillis);
  42. private:
  43. // Dialog overrides
  44. virtual
  45. void
  46. OnDestroy();
  47. virtual
  48. bool
  49. OnCommand(
  50. HWND windowFrom,
  51. unsigned controlIDFrom,
  52. unsigned code);
  53. virtual
  54. void
  55. OnInit();
  56. virtual
  57. bool
  58. OnMessage(
  59. UINT message,
  60. WPARAM wparam,
  61. LPARAM lparam);
  62. ThreadProc threadProc;
  63. int animationResId;
  64. struct WrapperThreadProcParams* threadParams;
  65. HANDLE buttonEventHandle;
  66. // not defined: no copying allowed
  67. ProgressDialog(const ProgressDialog&);
  68. const ProgressDialog& operator=(const ProgressDialog&);
  69. };
  70. #endif // PROGRESSDIALOG_HPP_INCLUDED