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.

206 lines
2.9 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name :
  4. progdlg.h
  5. Abstract:
  6. CProgressDialog dialog class implementation. This progress dialog
  7. is shown
  8. Author:
  9. Michael Cheuk (mcheuk)
  10. Project:
  11. Link Checker
  12. Revision History:
  13. --*/
  14. #include "stdafx.h"
  15. #include "linkchk.h"
  16. #include "progdlg.h"
  17. #include "lcmgr.h"
  18. #ifdef _DEBUG
  19. #define new DEBUG_NEW
  20. #undef THIS_FILE
  21. static char THIS_FILE[] = __FILE__;
  22. #endif
  23. CProgressDialog::CProgressDialog(
  24. ) :
  25. /*++
  26. Routine Description:
  27. Constructor.
  28. Arguments:
  29. N/A
  30. Return Value:
  31. N/A
  32. --*/
  33. CDialog(CProgressDialog::IDD, NULL)
  34. {
  35. //{{AFX_DATA_INIT(CProgressDialog)
  36. // NOTE: the ClassWizard will add member initialization here
  37. //}}AFX_DATA_INIT
  38. } // CProgressDialog::CProgressDialog
  39. void
  40. CProgressDialog::DoDataExchange(
  41. CDataExchange* pDX
  42. )
  43. /*++
  44. Routine Description:
  45. Called by MFC to change/retrieve dialog data
  46. Arguments:
  47. pDX -
  48. Return Value:
  49. N/A
  50. --*/
  51. {
  52. CDialog::DoDataExchange(pDX);
  53. //{{AFX_DATA_MAP(CProgressDialog)
  54. DDX_Control(pDX, IDC_PROGRESS_BUTTON, m_button);
  55. DDX_Control(pDX, IDC_PROGRESS_TEXT, m_staticProgressText);
  56. //}}AFX_DATA_MAP
  57. } //CProgressDialog::DoDataExchange
  58. BEGIN_MESSAGE_MAP(CProgressDialog, CDialog)
  59. //{{AFX_MSG_MAP(CProgressDialog)
  60. ON_BN_CLICKED(IDC_PROGRESS_BUTTON, OnProgressButton)
  61. //}}AFX_MSG_MAP
  62. END_MESSAGE_MAP()
  63. BOOL
  64. CProgressDialog::OnInitDialog(
  65. )
  66. /*++
  67. Routine Description:
  68. WM_INITDIALOG message handler
  69. Arguments:
  70. N/A
  71. Return Value:
  72. BOOL - TRUE if sucess. FALSE otherwise.
  73. --*/
  74. {
  75. CDialog::OnInitDialog();
  76. if(GetLinkCheckerMgr().Initialize((CProgressLog*)this))
  77. {
  78. if(GetLinkCheckerMgr().BeginWorkerThread())
  79. {
  80. return TRUE;
  81. }
  82. }
  83. CString str;
  84. str.LoadString(IDS_LC_FAIL);
  85. Log(str);
  86. str.LoadString(IDS_CLOSE);
  87. SetButtonText(str);
  88. return TRUE;
  89. } // CProgressDialog::OnInitDialog
  90. void
  91. CProgressDialog::OnProgressButton(
  92. )
  93. /*++
  94. Routine Description:
  95. Progress button click handler. This functions will terminate the
  96. worker thread or close the dialog.
  97. Arguments:
  98. N/A
  99. Return Value:
  100. N/A
  101. --*/
  102. {
  103. if(GetLinkCheckerMgr().IsWorkerThreadRunning())
  104. {
  105. CString str;
  106. str.LoadString(IDS_WORKER_THREAD_TERMINATE);
  107. Log(str);
  108. // signal the worker thread to terminate
  109. GetLinkCheckerMgr().SignalWorkerThreadToTerminate();
  110. }
  111. else
  112. {
  113. CDialog::OnOK();
  114. }
  115. } // CProgressDialog::OnProgressButton
  116. void
  117. CProgressDialog::WorkerThreadComplete(
  118. )
  119. /*++
  120. Routine Description:
  121. Worker thread notification.
  122. Arguments:
  123. N/A
  124. Return Value:
  125. N/A
  126. --*/
  127. {
  128. CString str;
  129. str.LoadString(IDS_PROGRESS_FINISH);
  130. Log(str);
  131. str.LoadString(IDS_CLOSE);
  132. SetButtonText(str);
  133. } // CProgressDialog::WorkerThreadComplete