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.

135 lines
4.0 KiB

  1. // ProgressDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "resource.h"
  5. #include "ProgressDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CProgressDlg dialog
  13. CProgressDlg::CProgressDlg(CWnd* pParent /*=NULL*/)
  14. : CDialog(CProgressDlg::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CProgressDlg)
  17. m_domainName = _T("");
  18. //}}AFX_DATA_INIT
  19. m_pParent = pParent;
  20. m_nID = CProgressDlg::IDD;
  21. }
  22. void CProgressDlg::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CProgressDlg)
  26. DDX_Control(pDX, IDC_PROGRESS1, m_progressCtrl);
  27. DDX_Control(pDX, IDC_DOMAIN_NAME, m_DomainCtrl);
  28. DDX_Text(pDX, IDC_DOMAIN_NAME, m_domainName);
  29. //}}AFX_DATA_MAP
  30. }
  31. BEGIN_MESSAGE_MAP(CProgressDlg, CDialog)
  32. //{{AFX_MSG_MAP(CProgressDlg)
  33. //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CProgressDlg message handlers
  37. BOOL CProgressDlg::OnInitDialog()
  38. {
  39. const int START = 0;
  40. CDialog::OnInitDialog();
  41. // TODO: Add extra initialization here
  42. lowerLimit = 0;
  43. upperLimit = 100;
  44. bCanceled = FALSE; //clear the "has the user canceled" flag
  45. m_progressCtrl.SetPos(START); //start the progress control at the beginning
  46. m_domainName = L"";
  47. UpdateData(FALSE);
  48. return TRUE; // return TRUE unless you set the focus to a control
  49. // EXCEPTION: OCX Property Pages should return FALSE
  50. }
  51. void CProgressDlg::OnCancel()
  52. {
  53. // TODO: Add extra cleanup here
  54. bCanceled = TRUE; //set the "has the user canceled" flag
  55. // CDialog::OnCancel();
  56. }
  57. BOOL CProgressDlg::Create()
  58. {
  59. return CDialog::Create(m_nID, m_pParent);
  60. }
  61. /*********************************************************************
  62. * *
  63. * Written by: Paul Thompson *
  64. * Date: 22 AUG 2000 *
  65. * *
  66. * This public member function of the CProgressDlg class is *
  67. * responsible for trying to grab this dialog's messages from the *
  68. * message queue and dispatch them. We are having to do this in *
  69. * order to receive a hit on the Cancel button. *
  70. * *
  71. *********************************************************************/
  72. //BEGIN CheckForCancel
  73. void CProgressDlg::CheckForCancel(void)
  74. {
  75. /* local constants */
  76. /* local variables */
  77. MSG aMsg;
  78. /* function body */
  79. while (PeekMessage(&aMsg, m_hWnd, 0, 0, PM_REMOVE))
  80. {
  81. if (!PreTranslateMessage(&aMsg))
  82. {
  83. TranslateMessage(&aMsg);
  84. DispatchMessage(&aMsg);
  85. }
  86. }
  87. }//END CheckForCancel
  88. /*********************************************************************
  89. * *
  90. * Written by: Paul Thompson *
  91. * Date: 22 AUG 2000 *
  92. * *
  93. * This public member function of the CProgressDlg class is *
  94. * responsible for setting the amount the progress control will *
  95. * advance per single step based on the number of domains to process.*
  96. * *
  97. *********************************************************************/
  98. //BEGIN SetIncrement
  99. void CProgressDlg::SetIncrement(int numDomains)
  100. {
  101. /* local constants */
  102. const short MIN_STEPS = 10;
  103. /* local variables */
  104. /* function body */
  105. lowerLimit = 0;
  106. upperLimit = (short)numDomains * MIN_STEPS;
  107. m_progressCtrl.SetRange(lowerLimit, upperLimit);
  108. m_progressCtrl.SetStep(MIN_STEPS);
  109. UpdateWindow(); //force a paint of the dialog
  110. }//END SetIncrement