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.

224 lines
5.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: amc.h
  8. //
  9. //--------------------------------------------------------------------------
  10. // AMC.h : main header file for the AMC application
  11. //
  12. #ifndef __AMC_H__
  13. #define __AMC_H__
  14. #ifndef __AFXWIN_H__
  15. #error include 'stdafx.h' before including this file for PCH
  16. #endif
  17. class CAMCDoc;
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CAMCApp:
  20. // See AMC.cpp for the implementation of this class
  21. //
  22. class CMainFrame;
  23. class CAMCApp : public CWinApp, public CAMCViewObserver,
  24. public CAMCViewToolbarsObserver, public CConsoleEventDispatcher
  25. {
  26. friend class CMMCApplication;
  27. DECLARE_DYNAMIC (CAMCApp)
  28. typedef std::list<HWND> WindowList;
  29. typedef std::list<HWND>::iterator WindowListIterator;
  30. // object model
  31. public:
  32. SC ScGet_Application(_Application **pp_Application);
  33. SC ScRegister_Application(_Application *p_Application);
  34. private:
  35. _ApplicationPtr m_sp_Application;
  36. public:
  37. SC ScCheckMMCPrerequisites();
  38. virtual BOOL PumpMessage(); // low level message pump
  39. virtual BOOL PreTranslateMessage(MSG* pMsg);
  40. virtual void RegisterShellFileTypes(BOOL bCompat);
  41. CAMCApp();
  42. // Attributes
  43. public:
  44. CMainFrame * GetMainFrame();
  45. // Operations
  46. public:
  47. void SetDefaultDirectory();
  48. void SaveUserDirectory(LPCTSTR pszUserDir);
  49. CString GetUserDirectory();
  50. CString GetDefaultDirectory();
  51. HMENU GetMenu () const
  52. {
  53. return (m_Menu);
  54. }
  55. ProgramMode GetMode() const
  56. {
  57. ASSERT (IsValidProgramMode (m_eMode));
  58. return (m_eMode);
  59. }
  60. bool IsInitializing() const
  61. {
  62. return (m_fInitializing);
  63. }
  64. bool DidCloseComeFromMainPump() const
  65. {
  66. return (m_fCloseCameFromMainPump);
  67. }
  68. void ResetCloseCameFromMainPump()
  69. {
  70. m_fCloseCameFromMainPump = false;
  71. }
  72. void DelayCloseUntilIdle (bool fDelay = true)
  73. {
  74. m_fDelayCloseUntilIdle = fDelay;
  75. }
  76. bool IsWin9xPlatform() const
  77. {
  78. return m_fIsWin9xPlatform;
  79. }
  80. bool IsMMCRunningAsOLEServer() const { return m_fRunningAsOLEServer;}
  81. void UpdateFrameWindow(bool bUpdate);
  82. void InitializeMode (ProgramMode eMode);
  83. void SetMode (ProgramMode eMode);
  84. void HookPreTranslateMessage (CWnd* pwndHook);
  85. void UnhookPreTranslateMessage (CWnd* pwndUnhook);
  86. CIdleTaskQueue * GetIdleTaskQueue ();
  87. SC ScShowHtmlHelp(LPCTSTR pszFile, DWORD_PTR dwData);
  88. // helpers for script event firing
  89. SC ScOnNewDocument(CAMCDoc *pDocument, BOOL bLoadedFromConsole);
  90. SC ScOnCloseDocument(CAMCDoc *pDocument);
  91. SC ScOnQuitApp();
  92. SC ScOnSnapinAdded (CAMCDoc *pDocument, PSNAPIN pSnapIn);
  93. SC ScOnSnapinRemoved(CAMCDoc *pDocument, PSNAPIN pSnapIn);
  94. SC ScOnNewView(CAMCView *pView);
  95. bool IsUnderUserControl() { return m_fUnderUserControl;}
  96. protected:
  97. void SetUnderUserControl(bool bUserControl = true);
  98. // Interfaces
  99. private:
  100. BOOL InitializeOLE();
  101. void DeinitializeOLE();
  102. SC ScUninitializeHelpControl();
  103. HRESULT DumpConsoleFile (CString strConsoleFile, CString strDumpFile);
  104. private:
  105. SC ScProcessAuthorModeRestrictions();
  106. private:
  107. BOOL m_bOleInitialized;
  108. BOOL m_bDefaultDirSet;
  109. bool m_fAuthorModeForced;
  110. bool m_fInitializing;
  111. bool m_fDelayCloseUntilIdle;
  112. bool m_fCloseCameFromMainPump;
  113. int m_nMessagePumpNestingLevel;
  114. bool m_fUnderUserControl;
  115. bool m_fRunningAsOLEServer;
  116. CIdleTaskQueue m_IdleTaskQueue;
  117. ProgramMode m_eMode;
  118. CMenu m_Menu;
  119. CAccel m_Accel;
  120. WindowList m_TranslateMessageHookWindows;
  121. bool m_fIsWin9xPlatform;
  122. static const TCHAR m_szSettingsSection[];
  123. static const TCHAR m_szUserDirectoryEntry[];
  124. bool m_bHelpInitialized;
  125. DWORD m_dwHelpCookie;
  126. // Overrides
  127. // ClassWizard generated virtual function overrides
  128. //{{AFX_VIRTUAL(CAMCApp)
  129. public:
  130. virtual BOOL InitInstance();
  131. virtual int ExitInstance();
  132. virtual BOOL OnIdle(LONG lCount);
  133. //}}AFX_VIRTUAL
  134. // Implementation
  135. #ifdef _DEBUG
  136. virtual void AssertValid() const;
  137. #endif
  138. //{{AFX_MSG(CAMCApp)
  139. afx_msg void OnAppAbout();
  140. afx_msg void OnFileNewInUserMode(); // do nothing in user mode when CTRL+N is pressed. This handler prevents the hotkey from going to any WebBrowser controls
  141. //}}AFX_MSG
  142. DECLARE_MESSAGE_MAP()
  143. // Observed view events - each fires a com event
  144. protected:
  145. virtual SC ScOnCloseView( CAMCView *pView );
  146. virtual SC ScOnViewChange( CAMCView *pView, HNODE hNode );
  147. virtual SC ScOnResultSelectionChange( CAMCView *pView );
  148. virtual SC ScOnContextMenuExecuted( PMENUITEM pMenuItem );
  149. virtual SC ScOnListViewItemUpdated(CAMCView *pView , int nIndex);
  150. // toolbar events
  151. virtual SC ScOnToolbarButtonClicked( );
  152. // Object model related code - these are in a private block
  153. // because CMMCApplication is a friend class
  154. private:
  155. SC ScHelp();
  156. SC ScRunTestScript();
  157. };
  158. inline CAMCApp* AMCGetApp()
  159. {
  160. extern CAMCApp theApp;
  161. return (&theApp);
  162. }
  163. inline CIdleTaskQueue * AMCGetIdleTaskQueue()
  164. {
  165. return (AMCGetApp()->GetIdleTaskQueue());
  166. }
  167. extern const CRect g_rectEmpty;
  168. #ifdef DBG
  169. extern CTraceTag tagForceMirror;
  170. #endif
  171. /////////////////////////////////////////////////////////////////////////////
  172. #endif //__AMC_H__