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.

357 lines
10 KiB

  1. /*
  2. * basewin.hxx
  3. *
  4. * Copyright (c) 1998 Microsoft Corporation
  5. *
  6. * Purpose: Defines the base window classes for Trigger
  7. *
  8. * Owner: pierrec
  9. *
  10. */
  11. // Includes
  12. // Forward Classes Definitions
  13. #define DLLAPI __declspec(dllexport)
  14. class CBaseFrame; // Application Frame
  15. class CBaseWindow; // Any window.
  16. //
  17. // This string must be defined by the target (exadmin, maildsmx, adcadmin, etc...)
  18. //
  19. extern const tstring szHelpFileCONTEXT; // Name of the context-sensitive help file
  20. // To parse the command line.
  21. #define szCommandSeparator _T("/")
  22. // class CBaseWindow
  23. /*
  24. * Purpose: Provide a common inheritance for all our window
  25. * wrapper classes.
  26. *
  27. * Useage: The only method is Hwnd()... The creation methods
  28. * of the CBaseXxxx classes ensure m_hwnd is set.
  29. *
  30. * Inheritance: CBaseWindow
  31. *
  32. * File: base\basewin.cxx
  33. */
  34. class DLLAPI CBaseWindow
  35. {
  36. private:
  37. HWND m_hwnd;
  38. public:
  39. CBaseWindow(void)
  40. {
  41. m_hwnd = NULL;
  42. }
  43. virtual ~CBaseWindow(void);
  44. void SetHwnd(HWND hwnd)
  45. {
  46. m_hwnd = hwnd;
  47. }
  48. HWND Hwnd( void )
  49. {
  50. ASSERT(!m_hwnd || IsWindow(m_hwnd));
  51. return m_hwnd;
  52. }
  53. // In CACLEditor, we want to cleanup information we were keeping
  54. // per HWND. So even though the window has been destroyed, we want
  55. // to know what the HWND used to be.
  56. HWND HwndWithoutASSERT(void)
  57. {
  58. return m_hwnd;
  59. }
  60. void Attach(HWND hwnd);
  61. static CBaseWindow * Pwin(HWND hwnd);
  62. void Detach();
  63. static void InvalidateWindow(PVOID pv);
  64. };
  65. // class CBaseFrame
  66. /*
  67. * Purpose: Implements the basic functionnality of the Frame window.
  68. *
  69. * Useage: There is only ONE object of this type. You can obtain a
  70. * pointer to this object by calling the static method Pframe().
  71. *
  72. * The 3 virtual methods ScInitApplication(),
  73. * ScInitInstance() and DeinitInstance() do the normal
  74. * thing. The method ScRegisterFrameClass() is provided
  75. * to simplify the window class registration call.
  76. *
  77. * Objects embedded in derived classes can be initialized
  78. * in ScInitInstance(), they are destructed in OnDestroy()
  79. * (which is called when the Windows objects still exist.
  80. *
  81. * The message loop is handled automatically, such that
  82. * classes derived from CBaseFrame typically only need to
  83. * provide the virtual methods.
  84. * If additionnal processing of the incoming window messages
  85. * is required, you may also override LWndProc().
  86. *
  87. * IdMessageBox() is THE place to report errors, Frame classes
  88. * derived from CBaseFrame may override this method (e.g. service)
  89. *
  90. * Also, a few methods are available to get the activation
  91. * information:
  92. * HInstance()
  93. * HPrevInst()
  94. * SzCmdLine()
  95. * NCmdShow()
  96. *
  97. * Finally, some utility methods are provided:
  98. * Hicon() returns a handle to the Application Icon.
  99. * GetHelp() Calls WinHelp
  100. * PformActive() returns the active MDI child
  101. *
  102. * Inheritance: CBaseFrame CBaseWindow
  103. *
  104. * File: base\basewin.cxx
  105. */
  106. class CMMCFrame;
  107. class DLLAPI CBaseFrame : public CBaseWindow
  108. {
  109. friend class CMMCFrame;
  110. public:
  111. // Note: A snapin is also a DLL so we answer TRUE for both FDLL and FSnapin.
  112. static BOOL FDLL(void)
  113. {
  114. return TRUE;
  115. }
  116. static BOOL FSnapin(void)
  117. {
  118. return TRUE;
  119. }
  120. private:
  121. HACCEL m_haccelSingleFrame;
  122. HACCEL m_haccelFrame;
  123. DWORD m_dwFrameComponentBits;
  124. DWORD m_dwFrameModeBits;
  125. public:
  126. static HINSTANCE s_hinst;
  127. private:
  128. static HINSTANCE s_hinstPrev;
  129. static HINSTANCE s_hinstMailBase;
  130. static CBaseFrame * s_pframe;
  131. private:
  132. INT m_nReturn;
  133. BOOL m_fExit;
  134. protected:
  135. HICON m_hicon;
  136. public:
  137. CBaseFrame();
  138. virtual ~CBaseFrame(void);
  139. virtual HACCEL HaccelSingleFrame(void)
  140. {
  141. return m_haccelSingleFrame;
  142. }
  143. virtual void SetHaccelSingleFrame(HACCEL haccel)
  144. {
  145. m_haccelSingleFrame = haccel;
  146. }
  147. virtual HACCEL HaccelFrame(void)
  148. {
  149. return m_haccelFrame;
  150. }
  151. virtual void SetHaccelFrame(HACCEL haccel)
  152. {
  153. m_haccelFrame = haccel;
  154. }
  155. virtual DWORD DwFrameComponentBits(void)
  156. {
  157. return m_dwFrameComponentBits;
  158. }
  159. virtual void SetFrameComponentBits(DWORD dwComp)
  160. {
  161. m_dwFrameComponentBits = dwComp;
  162. }
  163. virtual DWORD DwActiveModeBits(void);
  164. static HINSTANCE Hinst(void)
  165. {
  166. return s_hinst;
  167. }
  168. static HINSTANCE HinstPrev(void)
  169. {
  170. return s_hinstPrev;
  171. }
  172. static CBaseFrame * Pframe(void)
  173. {
  174. return s_pframe;
  175. }
  176. virtual SC ScInitApplication(void) = 0;
  177. virtual void DeinitApplication(void) = 0;
  178. virtual SC ScInitInstance(void);
  179. virtual LONG IdMessageBox(tstring& szMessage, UINT fuStyle);
  180. virtual void OnDestroy(void);
  181. virtual void DeinitInstance(void);
  182. virtual HICON Hicon(void)
  183. {
  184. return m_hicon;
  185. }
  186. virtual INT NReturn(void)
  187. {
  188. return m_nReturn;
  189. }
  190. virtual void SetNReturn(INT n)
  191. {
  192. m_nReturn = n;
  193. }
  194. virtual BOOL FExit(void)
  195. {
  196. return m_fExit;
  197. }
  198. virtual void SetFExit(BOOL f)
  199. {
  200. m_fExit = f;
  201. }
  202. friend int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int );
  203. friend SC ScInitDLL(HINSTANCE);
  204. friend void SetHinst(HINSTANCE hinst);
  205. }; //*** class CBaseFrame
  206. // class CBaseFrame
  207. /*
  208. * Purpose: Implements the basic functionnality of the Frame window.
  209. *
  210. * Useage: There is only ONE object of this type. You can obtain a
  211. * pointer to this object by calling the static method Pframe().
  212. *
  213. * The 3 virtual methods ScInitApplication(),
  214. * ScInitInstance() and DeinitInstance() do the normal
  215. * thing. The method ScRegisterFrameClass() is provided
  216. * to simplify the window class registration call.
  217. *
  218. * Objects embedded in derived classes can be initialized
  219. * in ScInitInstance(), they are destructed in OnDestroy()
  220. * (which is called when the Windows objects still exist.
  221. *
  222. * The message loop is handled automatically, such that
  223. * classes derived from CBaseFrame typically only need to
  224. * provide the virtual methods.
  225. * If additionnal processing of the incoming window messages
  226. * is required, you may also override LWndProc().
  227. *
  228. * IdMessageBox() is THE place to report errors, Frame classes
  229. * derived from CBaseFrame may override this method (e.g. service)
  230. *
  231. * Also, a few methods are available to get the activation
  232. * information:
  233. * HInstance()
  234. * HPrevInst()
  235. * SzCmdLine()
  236. * NCmdShow()
  237. *
  238. * Finally, some utility methods are provided:
  239. * Hicon() returns a handle to the Application Icon.
  240. * GetHelp() Calls WinHelp
  241. * PformActive() returns the active MDI child
  242. *
  243. * Inheritance: CBaseFrame CBaseWindow
  244. *
  245. * File: base\basewin.cxx
  246. */
  247. class CMMCFrame;
  248. class DLLAPI CBaseUIFrame : public CBaseFrame
  249. {
  250. typedef CBaseFrame _BaseClass;
  251. friend class CMMCFrame;
  252. public:
  253. static BOOL FMMC()
  254. {
  255. return true;
  256. }
  257. public:
  258. CBaseUIFrame()
  259. {
  260. }
  261. virtual ~CBaseUIFrame(void)
  262. {
  263. }
  264. static CBaseUIFrame * Pframe(void)
  265. {
  266. return(CBaseUIFrame *) CBaseFrame::Pframe();
  267. }
  268. virtual SC ScInitApplication(void) = 0;
  269. virtual void DeinitApplication(void) = 0;
  270. friend int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int );
  271. friend SC ScInitDLL(HINSTANCE);
  272. friend void SetHinst(HINSTANCE hinst);
  273. }; //*** class CBaseFrame
  274. // Free functions
  275. // Implemented by the local system requiring either WinMain
  276. // or the DLL stuff.
  277. // ScInitDLL & DeinitDLL are kind of part 1 and part 2 of WinMain!
  278. // They are called by the DLLEntryPoint of MailUMX.
  279. // DO NOT CONFUSE: MAILBASE does NOT require ScInitDLL!
  280. int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int);
  281. SC ScInitDLL(HINSTANCE);
  282. void DeinitDLL(void);
  283. // Implemented in the EXE's subsystem...
  284. CBaseFrame * PframeCreate( void );