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.

204 lines
4.9 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. FTMan
  5. File Name:
  6. FTMan.cpp
  7. Abstract:
  8. Defines the class behaviors for the FTMan application.
  9. Author:
  10. Cristian Teodorescu October 20, 1998
  11. Notes:
  12. Revision History:
  13. --*/
  14. #include "stdafx.h"
  15. #include "Item.h"
  16. #include "FTDoc.h"
  17. #include "FTMan.h"
  18. #include "FTTreeVw.h"
  19. #include "MainFrm.h"
  20. #ifdef _DEBUG
  21. #define new DEBUG_NEW
  22. #undef THIS_FILE
  23. static char THIS_FILE[] = __FILE__;
  24. #endif
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CFTManApp
  27. BEGIN_MESSAGE_MAP(CFTManApp, CWinApp)
  28. //{{AFX_MSG_MAP(CFTManApp)
  29. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  30. // NOTE - the ClassWizard will add and remove mapping macros here.
  31. // DO NOT EDIT what you see in these blocks of generated code!
  32. //}}AFX_MSG_MAP
  33. // Standard file based document commands
  34. END_MESSAGE_MAP()
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CFTManApp construction
  37. CFTManApp::CFTManApp()
  38. {
  39. // TODO: add construction code here,
  40. // Place all significant initialization in InitInstance
  41. }
  42. /////////////////////////////////////////////////////////////////////////////
  43. // The one and only CFTManApp object
  44. CFTManApp theApp;
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CFTManApp initialization
  47. BOOL CFTManApp::InitInstance()
  48. {
  49. MY_TRY
  50. // Standard initialization
  51. // If you are not using these features and wish to reduce the size
  52. // of your final executable, you should remove from the following
  53. // the specific initialization routines you do not need.
  54. #ifndef _WIN64
  55. // Sundown: ctl3d is only necessary if you intend on running on NT 3.51
  56. #ifdef _AFXDLL
  57. Enable3dControls(); // Call this when using MFC in a shared DLL
  58. #else
  59. Enable3dControlsStatic(); // Call this when linking to MFC statically
  60. #endif
  61. #endif // !_WIN64
  62. // Change the registry key under which our settings are stored.
  63. // TODO: You should modify this string to be something appropriate
  64. // such as the name of your company or organization.
  65. //SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  66. //LoadStdProfileSettings(); // Load standard INI file options (including MRU)
  67. // Check whether the current user is a member of the Administrators group
  68. // If he/she's not then he/she can't use this application
  69. BOOL bIsAdministrator;
  70. if( !CheckAdministratorsMembership( bIsAdministrator ) )
  71. return FALSE;
  72. if( !bIsAdministrator )
  73. {
  74. AfxMessageBox(IDS_ERR_NOT_ADMINISTRATOR, MB_ICONSTOP);
  75. return FALSE;
  76. }
  77. // Register the application's document templates. Document templates
  78. // serve as the connection between documents, frame windows and views.
  79. CSingleDocTemplate* pDocTemplate;
  80. pDocTemplate = new CSingleDocTemplate(
  81. IDR_MAINFRAME,
  82. RUNTIME_CLASS(CFTDocument),
  83. RUNTIME_CLASS(CMainFrame), // main SDI frame window
  84. RUNTIME_CLASS(CFTTreeView));
  85. AddDocTemplate(pDocTemplate);
  86. // Parse command line for standard shell commands, DDE, file open
  87. CCommandLineInfo cmdInfo;
  88. ParseCommandLine(cmdInfo);
  89. // Dispatch commands specified on the command line
  90. if (!ProcessShellCommand(cmdInfo))
  91. return FALSE;
  92. // The one and only window has been initialized, so show and update it.
  93. m_bStatusBarUpdatedOnce = FALSE;
  94. m_pMainWnd->ShowWindow(SW_SHOW);
  95. m_pMainWnd->UpdateWindow();
  96. return TRUE;
  97. MY_CATCH_REPORT_AND_RETURN_FALSE
  98. }
  99. BOOL CFTManApp::OnIdle( LONG lCount )
  100. {
  101. // This is a dirty trick used to cover a status bar bug. I must repaint the status bar immediately after its
  102. // first painting because the last pane appears with border although it shouldn't
  103. if( !m_bStatusBarUpdatedOnce )
  104. {
  105. ((CMainFrame*)m_pMainWnd)->GetStatusBar()->InvalidateRect(NULL);
  106. ((CMainFrame*)m_pMainWnd)->GetStatusBar()->UpdateWindow();
  107. m_bStatusBarUpdatedOnce = TRUE;
  108. }
  109. return CWinApp::OnIdle( lCount );
  110. }
  111. /////////////////////////////////////////////////////////////////////////////
  112. // CAboutDlg dialog used for App About
  113. class CAboutDlg : public CDialog
  114. {
  115. public:
  116. CAboutDlg();
  117. // Dialog Data
  118. //{{AFX_DATA(CAboutDlg)
  119. enum { IDD = IDD_ABOUTBOX };
  120. //}}AFX_DATA
  121. // ClassWizard generated virtual function overrides
  122. //{{AFX_VIRTUAL(CAboutDlg)
  123. protected:
  124. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  125. //}}AFX_VIRTUAL
  126. // Implementation
  127. protected:
  128. //{{AFX_MSG(CAboutDlg)
  129. // No message handlers
  130. //}}AFX_MSG
  131. DECLARE_MESSAGE_MAP()
  132. };
  133. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  134. {
  135. //{{AFX_DATA_INIT(CAboutDlg)
  136. //}}AFX_DATA_INIT
  137. }
  138. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  139. {
  140. CDialog::DoDataExchange(pDX);
  141. //{{AFX_DATA_MAP(CAboutDlg)
  142. //}}AFX_DATA_MAP
  143. }
  144. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  145. //{{AFX_MSG_MAP(CAboutDlg)
  146. // No message handlers
  147. //}}AFX_MSG_MAP
  148. END_MESSAGE_MAP()
  149. // App command to run the dialog
  150. void CFTManApp::OnAppAbout()
  151. {
  152. CAboutDlg aboutDlg;
  153. aboutDlg.DoModal();
  154. }
  155. /////////////////////////////////////////////////////////////////////////////
  156. // CFTManApp message handlers