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.

148 lines
2.7 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name :
  4. linkchk.cpp
  5. Abstract:
  6. MFC CWinApp derived application class implementation.
  7. Author:
  8. Michael Cheuk (mcheuk)
  9. Project:
  10. Link Checker
  11. Revision History:
  12. --*/
  13. #include "stdafx.h"
  14. #include "linkchk.h"
  15. #include "maindlg.h"
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. BEGIN_MESSAGE_MAP(CLinkCheckerApp, CWinApp)
  22. //{{AFX_MSG_MAP(CLinkCheckerApp)
  23. // NOTE - the ClassWizard will add and remove mapping macros here.
  24. // DO NOT EDIT what you see in these blocks of generated code!
  25. //}}AFX_MSG
  26. ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  27. END_MESSAGE_MAP()
  28. // The one and only CLinkCheckerApp object
  29. CLinkCheckerApp theApp;
  30. BOOL
  31. CLinkCheckerApp::InitInstance(
  32. )
  33. /*++
  34. Routine Description:
  35. CLinkCheckerApp initialization
  36. Arguments:
  37. N/A
  38. Return Value:
  39. BOOl - TRUE if success. FALSE otherwise.
  40. --*/
  41. {
  42. // Standard initialization
  43. // If you are not using these features and wish to reduce the size
  44. // of your final executable, you should remove from the following
  45. // the specific initialization routines you do not need.
  46. #ifdef _AFXDLL
  47. Enable3dControls(); // Call this when using MFC in a shared DLL
  48. #else
  49. Enable3dControlsStatic(); // Call this when linking to MFC statically
  50. #endif
  51. ParseCmdLine(m_CmdLine);
  52. if(!m_CmdLine.CheckAndAddToUserOptions())
  53. {
  54. return FALSE;
  55. }
  56. CMainDialog dlg;
  57. m_pMainWnd = &dlg;
  58. int nResponse = dlg.DoModal();
  59. if (nResponse == IDOK)
  60. {
  61. // TODO: Place code here to handle when the dialog is
  62. // dismissed with OK
  63. }
  64. else if (nResponse == IDCANCEL)
  65. {
  66. // TODO: Place code here to handle when the dialog is
  67. // dismissed with Cancel
  68. }
  69. // Since the dialog has been closed, return FALSE so that we exit the
  70. // application, rather than start the application's message pump.
  71. return FALSE;
  72. } // CLinkCheckerApp::InitInstance(
  73. void
  74. CLinkCheckerApp::ParseCmdLine(
  75. CCmdLine& CmdLine
  76. )
  77. /*++
  78. Routine Description:
  79. Parse command line
  80. Arguments:
  81. CmdLine - command line object to store the data
  82. Return Value:
  83. N/A
  84. --*/
  85. {
  86. // Copy & modified from MFC
  87. for (int i=1; i<__argc; i++)
  88. {
  89. TCHAR chFlag = _TCHAR(' ');
  90. LPCTSTR lpszParam = __targv[i];
  91. // If this is a flag
  92. if (lpszParam[0] == _TCHAR('-'))
  93. {
  94. chFlag = lpszParam[1];
  95. if(i+1 < __argc)
  96. {
  97. lpszParam = __targv[++i];
  98. }
  99. else
  100. {
  101. lpszParam = NULL;
  102. }
  103. }
  104. // Parse the flag & the following parameter
  105. CmdLine.ParseParam(chFlag, lpszParam);
  106. }
  107. } // CLinkCheckerApp::ParseCmdLine