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.

287 lines
4.7 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name :
  4. maindlg.cpp
  5. Abstract:
  6. CMainDialog dialog class implementation. This is link checker
  7. the main dialog.
  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 "maindlg.h"
  17. #include "browser.h"
  18. #include "progdlg.h"
  19. #include "athendlg.h"
  20. #include "propsdlg.h"
  21. #include "lcmgr.h"
  22. #ifdef _DEBUG
  23. #define new DEBUG_NEW
  24. #undef THIS_FILE
  25. static char THIS_FILE[] = __FILE__;
  26. #endif
  27. CMainDialog::CMainDialog(
  28. CWnd* pParent /*=NULL*/
  29. ):
  30. /*++
  31. Routine Description:
  32. Constructor.
  33. Arguments:
  34. pParent - pointer to parent CWnd
  35. Return Value:
  36. N/A
  37. --*/
  38. CAppDialog(CMainDialog::IDD, pParent)
  39. {
  40. //{{AFX_DATA_INIT(CMainDialog)
  41. m_fLogToFile = TRUE;
  42. m_strLogFilename = _T("c:\\LinkError.log");
  43. m_fCheckLocalLinks = TRUE;
  44. m_fCheckRemoteLinks = TRUE;
  45. m_fLogToEventMgr = FALSE;
  46. //}}AFX_DATA_INIT
  47. } // CMainDialog::CMainDialog
  48. void
  49. CMainDialog::DoDataExchange(
  50. CDataExchange* pDX
  51. )
  52. /*++
  53. Routine Description:
  54. Called by MFC to change/retrieve dialog data
  55. Arguments:
  56. pDX -
  57. Return Value:
  58. N/A
  59. --*/
  60. {
  61. CAppDialog::DoDataExchange(pDX);
  62. //{{AFX_DATA_MAP(CMainDialog)
  63. DDX_Check(pDX, IDC_LOG_TO_FILE, m_fLogToFile);
  64. DDX_Text(pDX, IDC_LOG_FILENAME, m_strLogFilename);
  65. DDX_Check(pDX, IDC_CHECK_LOCAL_LINK, m_fCheckLocalLinks);
  66. DDX_Check(pDX, IDC_CHECK_REMOTE_LINK, m_fCheckRemoteLinks);
  67. DDX_Check(pDX, IDC_LOG_TO_EVENT_MANAGER, m_fLogToEventMgr);
  68. //}}AFX_DATA_MAP
  69. } // CMainDialog::DoDataExchange
  70. BEGIN_MESSAGE_MAP(CMainDialog, CAppDialog)
  71. //{{AFX_MSG_MAP(CMainDialog)
  72. ON_BN_CLICKED(IDC_MAIN_RUN, OnMainRun)
  73. ON_BN_CLICKED(IDC_MAIN_CLOSE, CAppDialog::OnOK)
  74. ON_WM_CREATE()
  75. ON_BN_CLICKED(IDC_ATHENICATION, OnAthenication)
  76. ON_BN_CLICKED(IDC_PROPERTIES, OnProperties)
  77. //}}AFX_MSG_MAP
  78. END_MESSAGE_MAP()
  79. void
  80. CMainDialog::OnMainRun(
  81. )
  82. /*++
  83. Routine Description:
  84. OK button click handler. This functions brings up the progress
  85. dialog.
  86. Arguments:
  87. N/A
  88. Return Value:
  89. N/A
  90. --*/
  91. {
  92. // Retrieve the data from dialog
  93. UpdateData();
  94. // Make sure we have at least one type
  95. // of link checking checked
  96. if(!m_fCheckLocalLinks && !m_fCheckRemoteLinks)
  97. {
  98. AfxMessageBox(IDS_LINKS_NOT_CHECKED);
  99. return;
  100. }
  101. // Set the user options in global CUserOptions
  102. GetLinkCheckerMgr().GetUserOptions().SetOptions(
  103. m_fCheckLocalLinks,
  104. m_fCheckRemoteLinks,
  105. m_fLogToFile,
  106. m_strLogFilename,
  107. m_fLogToEventMgr);
  108. // Show the progress dialog
  109. CProgressDialog dlg;
  110. dlg.DoModal();
  111. CAppDialog::OnOK();
  112. } // CMainDialog::OnMainRun
  113. int
  114. CMainDialog::OnCreate(
  115. LPCREATESTRUCT lpCreateStruct
  116. )
  117. /*++
  118. Routine Description:
  119. WM_CREATE message handler. Load the wininet.dll at this
  120. point.
  121. Arguments:
  122. N/A
  123. Return Value:
  124. int - -1 if wininet.dll fail. 0 otherwise.
  125. --*/
  126. {
  127. if (CAppDialog::OnCreate(lpCreateStruct) == -1)
  128. return -1;
  129. // Load the wininet.dll
  130. if (!GetLinkCheckerMgr().LoadWininet())
  131. {
  132. AfxMessageBox(IDS_WININET_LOAD_FAIL);
  133. return -1;
  134. }
  135. return 0;
  136. } // CMainDialog::OnCreate
  137. void
  138. CMainDialog::OnAthenication(
  139. )
  140. /*++
  141. Routine Description:
  142. Athenication button click handler. This functions brings up the
  143. athenication dialog.
  144. Arguments:
  145. N/A
  146. Return Value:
  147. N/A
  148. --*/
  149. {
  150. CAthenicationDialog dlg;
  151. dlg.DoModal();
  152. } // CMainDialog::OnAthenication
  153. void
  154. CMainDialog::OnProperties(
  155. )
  156. /*++
  157. Routine Description:
  158. Browser Properties button click handler. This functions brings up the browser
  159. properties dialog.
  160. Arguments:
  161. N/A
  162. Return Value:
  163. N/A
  164. --*/
  165. {
  166. CPropertiesDialog dlg;
  167. dlg.DoModal();
  168. } // CMainDialog::OnProperties
  169. BOOL
  170. CMainDialog::OnInitDialog(
  171. )
  172. /*++
  173. Routine Description:
  174. WM_INITDIALOG message handler
  175. Arguments:
  176. N/A
  177. Return Value:
  178. BOOL - TRUE if sucess. FALSE otherwise.
  179. --*/
  180. {
  181. CAppDialog::OnInitDialog();
  182. // Add the available browser to CUserOptions
  183. for(int i=0; i<iNumBrowsersAvailable_c; i++)
  184. {
  185. GetLinkCheckerMgr().GetUserOptions().AddAvailableBrowser(BrowsersAvailable_c[i]);
  186. }
  187. // Add the available language to CUserOptions
  188. for(i=0; i<iNumLanguagesAvailable_c; i++)
  189. {
  190. GetLinkCheckerMgr().GetUserOptions().AddAvailableLanguage(LanguagesAvailable_c[i]);
  191. }
  192. return TRUE; // return TRUE unless you set the focus to a control
  193. // EXCEPTION: OCX Property Pages should return FALSE
  194. } //CMainDialog::OnInitDialog