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.

250 lines
5.7 KiB

  1. //#--------------------------------------------------------------
  2. //
  3. // File: mainwindow.h
  4. //
  5. // Synopsis: This file holds the declarations of the
  6. // CMainWindow class
  7. //
  8. // History: 11/10/2000 serdarun Created
  9. //
  10. // Copyright (C) 1999-2000 Microsoft Corporation
  11. // All rights reserved.
  12. //
  13. //#--------------------------------------------------------------
  14. #ifndef _MAINWINDOW_H_
  15. #define _MAINWINDOW_H_
  16. #define SA_DISPLAY_MAX_BITMAP_IN_BYTES SA_DISPLAY_MAX_BITMAP_SIZE/8
  17. #include <exdispid.h>
  18. #include <atlhost.h>
  19. #include "saio.h"
  20. #include "ieeventhandler.h"
  21. #include "langchange.h"
  22. #include "salocmgr.h"
  23. #include "ldm.h"
  24. #include <string>
  25. using namespace std;
  26. #include "sacom.h"
  27. #include "saconsumer.h"
  28. class CMainWindow : public CWindowImpl<CMainWindow>
  29. {
  30. public:
  31. BEGIN_MSG_MAP(CMainWindow)
  32. MESSAGE_HANDLER(WM_TIMER, OnTimer)
  33. MESSAGE_HANDLER(WM_CREATE, OnCreate)
  34. MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
  35. MESSAGE_HANDLER(WM_SETFOCUS, OnFocus)
  36. MESSAGE_HANDLER(wm_SaKeyMessage,OnSaKeyMessage)
  37. MESSAGE_HANDLER(wm_SaLocMessage,OnSaLocMessage)
  38. MESSAGE_HANDLER(wm_SaLEDMessage,OnSaLEDMessage)
  39. MESSAGE_HANDLER(wm_SaAlertMessage,OnSaAlertMessage)
  40. END_MSG_MAP()
  41. CMainWindow();
  42. LRESULT OnTimer(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  43. LRESULT OnFocus(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  44. LRESULT OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  45. LRESULT OnDestroy(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  46. LRESULT OnSaKeyMessage(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  47. LRESULT OnSaLocMessage(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  48. LRESULT OnSaLEDMessage(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  49. LRESULT OnSaAlertMessage(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  50. void PageLoaded(IDispatch* pdisp, VARIANT* purl);
  51. void RegistryPageLoaded(IDispatch* pdisp, VARIANT* purl);
  52. void LoadingNewPage();
  53. void GetBitmap();
  54. HRESULT Initialize();
  55. private:
  56. //
  57. // Clear the resources
  58. //
  59. void ShutDown();
  60. //
  61. // method to register alert consumer in WMI sink
  62. //
  63. HRESULT InitWMIConsumer();
  64. //
  65. // method to initialize display helper component
  66. //
  67. HRESULT InitDisplayComponent ();
  68. //
  69. // create the language change class
  70. // initialize the connection to localization manager
  71. //
  72. HRESULT InitLanguageCallback();
  73. //
  74. // determines the port number for default web site
  75. // and construct URLs for localui pages
  76. //
  77. HRESULT ConstructUrlStrings();
  78. //
  79. // creates the main IE control that is used for rendering
  80. //
  81. HRESULT CreateMainIEControl();
  82. //
  83. // creates the second IE control that is used for startup pages
  84. //
  85. HRESULT CreateSecondIEControl();
  86. void PrintRegistryPage();
  87. //
  88. // sets an active element on a page if nothing is selected
  89. //
  90. void CMainWindow::CorrectTheFocus();
  91. //
  92. // here are the private resource handles
  93. //
  94. LONG m_lDispHeight;
  95. LONG m_lDispWidth;
  96. HANDLE m_hWorkerThread;
  97. BOOL m_bSecondIECreated;
  98. public:
  99. //
  100. // display component object
  101. //
  102. CComPtr<ISaDisplay> m_pSaDisplay;
  103. //
  104. // worker function to read messages from keypad
  105. //
  106. void KeypadReader();
  107. //
  108. // pointers to main IE control
  109. //
  110. CComPtr<IWebBrowser2> m_pMainWebBrowser;
  111. CComPtr<IUnknown> m_pMainWebBrowserUnk;
  112. CComPtr<IOleInPlaceActiveObject> m_pMainInPlaceAO;
  113. CComPtr<IOleObject> m_pMainOleObject;
  114. CComPtr<IViewObject2> m_pMainViewObject;
  115. CComObject<CWebBrowserEventSink>* m_pMainWebBrowserEventSink;
  116. //
  117. // window handle of the main IE control
  118. //
  119. HWND m_hwndWebBrowser;
  120. DWORD m_dwMainCookie;
  121. //
  122. // state of the startup pages
  123. //
  124. SA_REGISTRYBITMAP_STATE m_RegBitmapState;
  125. //
  126. // Language change
  127. //
  128. CLangChange *m_pLangChange;
  129. ISALocInfo *m_pLocInfo;
  130. //
  131. // pointers to second IE control
  132. // this one is used render startup pages
  133. //
  134. CComPtr<IWebBrowser2> m_pSecondWebBrowser;
  135. CComPtr<IUnknown> m_pSecondWebBrowserUnk;
  136. CComObject<CWebBrowserEventSink>* m_pSecondWebBrowserEventSink;
  137. DWORD m_dwSecondCookie;
  138. //
  139. // GDI objects used for drawing
  140. //
  141. HDC m_HdcMem;
  142. HBITMAP m_hBitmap;
  143. //
  144. // timers for the registry and main page
  145. //
  146. UINT_PTR m_unintptrMainTimer;
  147. UINT_PTR m_unintptrSecondTimer;
  148. DWORD id;
  149. //
  150. // flag for the ready state of web page
  151. //
  152. BOOL m_bPageReady;
  153. //
  154. // Pointer to keypad controller component
  155. //
  156. CComPtr<ISAKeypadController> m_pSAKeypadController;
  157. //
  158. // Pointer to consumer component
  159. //
  160. CComPtr<IWbemObjectSink> m_pSAWbemSink;
  161. //
  162. // Pointer to saconsumer interface
  163. //
  164. CSAConsumer *m_pSAConsumer;
  165. //
  166. // led message dword
  167. //
  168. DWORD m_dwLEDMessageCode;
  169. //
  170. // URL strings
  171. //
  172. wstring m_szMainPage;
  173. BOOL m_bInTaskorMainPage;
  174. //
  175. // %system32%\ServerAppliance\LocalUI
  176. //
  177. wstring m_szLocalUIDir;
  178. //
  179. // Pointer to Wbem services component
  180. //
  181. CComPtr <IWbemServices> m_pWbemServices;
  182. //
  183. //
  184. //
  185. BOOL m_bActiveXFocus;
  186. };
  187. #endif //_MAINWINDOW_H_