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.

348 lines
8.1 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. /*++
  3. Copyright (C) Microsoft Corporation, 1997 - 1999
  4. Module Name:
  5. LogAbout.cpp
  6. Abstract:
  7. Implementation file for the CLoggingSnapinAbout class.
  8. The CLoggingSnapinAbout class implements the ISnapinAbout interface which enables the MMC
  9. console to get copyright and version information from the snap-in.
  10. The console also uses this interface to obtain images for the static folder
  11. from the snap-in.
  12. Revision History:
  13. mmaguire 11/6/97 - created using MMC snap-in wizard
  14. --*/
  15. //////////////////////////////////////////////////////////////////////////////
  16. //////////////////////////////////////////////////////////////////////////////
  17. // BEGIN INCLUDES
  18. //
  19. // standard includes:
  20. //
  21. #include "Precompiled.h"
  22. //
  23. // where we can find declaration for main class in this file:
  24. //
  25. #include "LogAbout.h"
  26. //
  27. //
  28. // where we can find declarations needed in this file:
  29. //
  30. //
  31. // END INCLUDES
  32. //////////////////////////////////////////////////////////////////////////////
  33. //////////////////////////////////////////////////////////////////////////////
  34. /*++
  35. CLoggingSnapinAbout::GetSnapinDescription
  36. Enables the console to obtain the text for the snap-in's description box.
  37. HRESULT GetSnapinDescription(
  38. LPOLESTR * lpDescription // Pointer to the description text.
  39. );
  40. Parameters
  41. lpDescription
  42. [out] Pointer to the text for the description box on an About property page.
  43. Return Values
  44. S_OK
  45. The text was successfully obtained.
  46. Remarks
  47. Memory for out parameters must be allocated using CoTaskMemAlloc. This function is documented in the Platform SDK.
  48. --*/
  49. //////////////////////////////////////////////////////////////////////////////
  50. STDMETHODIMP CLoggingSnapinAbout::GetSnapinDescription (LPOLESTR *lpDescription)
  51. {
  52. ATLTRACE(_T("+NAPMMC+:# CLoggingSnapinAbout::GetSnapinDescription\n"));
  53. USES_CONVERSION;
  54. TCHAR szBuf[256];
  55. if (::LoadString(_Module.GetResourceInstance(), IDS_NAPSNAPIN_DESC, szBuf, 256) == 0)
  56. return E_FAIL;
  57. *lpDescription = (LPOLESTR)CoTaskMemAlloc((lstrlen(szBuf) + 1) * sizeof(TCHAR));
  58. if (*lpDescription == NULL)
  59. return E_OUTOFMEMORY;
  60. ocscpy(*lpDescription, T2OLE(szBuf));
  61. return S_OK;
  62. }
  63. //////////////////////////////////////////////////////////////////////////////
  64. /*++
  65. CLoggingSnapinAbout::GetProvider
  66. Enables the console to obtain the snap-in provider's name.
  67. HRESULT GetProvider(
  68. LPOLESTR * lpName // Pointer to the provider's name
  69. );
  70. Parameters
  71. lpName
  72. [out] Pointer to the text making up the snap-in provider's name.
  73. Return Values
  74. S_OK
  75. The name was successfully obtained.
  76. Remarks
  77. Memory for out parameters must be allocated using CoTaskMemAlloc. This function is documented in the Platform SDK.
  78. --*/
  79. //////////////////////////////////////////////////////////////////////////////
  80. STDMETHODIMP CLoggingSnapinAbout::GetProvider (LPOLESTR *lpName)
  81. {
  82. ATLTRACE(_T("+NAPMMC+:# CLoggingSnapinAbout::GetProvider\n"));
  83. USES_CONVERSION;
  84. TCHAR szBuf[256];
  85. if (::LoadString(_Module.GetResourceInstance(), IDS_NAPSNAPIN_PROVIDER, szBuf, 256) == 0)
  86. return E_FAIL;
  87. *lpName = (LPOLESTR)CoTaskMemAlloc((lstrlen(szBuf) + 1) * sizeof(TCHAR));
  88. if (*lpName == NULL)
  89. return E_OUTOFMEMORY;
  90. ocscpy(*lpName, T2OLE(szBuf));
  91. return S_OK;
  92. }
  93. //////////////////////////////////////////////////////////////////////////////
  94. /*++
  95. CLoggingSnapinAbout::GetSnapinVersion
  96. Enables the console to obtain the snap-in's version number.
  97. HRESULT GetSnapinVersion(
  98. LPOLESTR* lpVersion // Pointer to the version number.
  99. );
  100. Parameters
  101. lpVersion
  102. [out] Pointer to the text making up the snap-in's version number.
  103. Return Values
  104. S_OK
  105. The version number was successfully obtained.
  106. Remarks
  107. Memory for out parameters must be allocated using CoTaskMemAlloc. This function is documented in the Platform SDK.
  108. --*/
  109. //////////////////////////////////////////////////////////////////////////////
  110. STDMETHODIMP CLoggingSnapinAbout::GetSnapinVersion (LPOLESTR *lpVersion)
  111. {
  112. ATLTRACE(_T("+NAPMMC+:# CLoggingSnapinAbout::GetSnapinVersion\n"));
  113. USES_CONVERSION;
  114. TCHAR szBuf[256];
  115. if (::LoadString(_Module.GetResourceInstance(), IDS_NAPSNAPIN_VERSION, szBuf, 256) == 0)
  116. return E_FAIL;
  117. *lpVersion = (LPOLESTR)CoTaskMemAlloc((lstrlen(szBuf) + 1) * sizeof(TCHAR));
  118. if (*lpVersion == NULL)
  119. return E_OUTOFMEMORY;
  120. ocscpy(*lpVersion, T2OLE(szBuf));
  121. return S_OK;
  122. }
  123. //////////////////////////////////////////////////////////////////////////////
  124. /*++
  125. CLoggingSnapinAbout::GetSnapinImage
  126. Enables the console to obtain the snap-in's main icon to be used in the About box.
  127. HRESULT GetSnapinImage(
  128. HICON * hAppIcon // Pointer to the application's main icon
  129. );
  130. Parameters
  131. hAppIcon
  132. [out] Pointer to the handle of the main icon of the snap-in that is to be used in the About property page.
  133. Return Values
  134. S_OK
  135. The handle to the icon was successfully obtained.
  136. ISSUE: What do I return if I can't get the icon?
  137. Remarks
  138. Memory for out parameters must be allocated using CoTaskMemAlloc. This function is documented in the Platform SDK.
  139. --*/
  140. //////////////////////////////////////////////////////////////////////////////
  141. STDMETHODIMP CLoggingSnapinAbout::GetSnapinImage (HICON *hAppIcon)
  142. {
  143. ATLTRACE(_T("+NAPMMC+:# CLoggingSnapinAbout::GetSnapinImage\n"));
  144. // ISSUE: be sure it is GetSnapinImage that returns this icon and not something
  145. // from GetStaticFolderImage.
  146. // ISSUE: should probably use LoadImage here instead
  147. if ( NULL == (*hAppIcon = ::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_NAP_SNAPIN_IMAGE) ) ) )
  148. return E_FAIL;
  149. return S_OK;
  150. }
  151. //////////////////////////////////////////////////////////////////////////////
  152. /*++
  153. CLoggingSnapinAbout::GetStaticFolderImage
  154. Allows the console to obtain the static folder images for the scope and result panes.
  155. As of version 1.1 of MMC, the icon returned here will be the icon used on
  156. the root node of our snapin.
  157. HRESULT GetStaticFolderImage(
  158. HBITMAP * hSmallImage, // Pointer to a handle to a small icon.
  159. HBITMAP * hSmallImageOpen, // Pointer to a handle to open folder
  160. // icon.
  161. HBITMAP * hLargeImage, // Pointer to a handle to a large icon.
  162. COLORREF * cMask // Color used to generate a mask.
  163. );
  164. Parameter
  165. hSmallImage
  166. [out] Pointer to the handle of a small icon (16x16n pixels) in either the scope or result view pane.
  167. hSmallImageOpen
  168. [out] Pointer to the handle of a small open-folder icon (16x16n pixels).
  169. hLargImage
  170. [out] Pointer to the handle of a large icon (32x32n pixels).
  171. cMask
  172. [out] Pointer to a COLORREF structure that specifies the color used to generate a mask. This structure is documented in the Platform SDK.
  173. Return Values
  174. S_OK
  175. The icon was successfully obtained.
  176. ISSUE: What should we return if we fail?
  177. --*/
  178. //////////////////////////////////////////////////////////////////////////////
  179. STDMETHODIMP CLoggingSnapinAbout::GetStaticFolderImage (
  180. HBITMAP *hSmallImage,
  181. HBITMAP *hSmallImageOpen,
  182. HBITMAP *hLargeImage,
  183. COLORREF *cMask)
  184. {
  185. ATLTRACE(_T("+NAPMMC+:# CLoggingSnapinAbout::GetStaticFolderImage\n"));
  186. /*
  187. if( NULL == (*hSmallImageOpen = (HBITMAP) LoadImage(
  188. _Module.GetResourceInstance(), // handle of the instance that contains the image
  189. MAKEINTRESOURCE(IDB_CRAPWIZ_OPEN_16), // name or identifier of image
  190. IMAGE_BITMAP, // type of image
  191. 0, // desired width
  192. 0, // desired height
  193. LR_DEFAULTCOLOR // load flags
  194. ) ) )
  195. {
  196. return E_FAIL;
  197. }
  198. if( NULL == (*hSmallImage = (HBITMAP) LoadImage(
  199. _Module.GetResourceInstance(), // handle of the instance that contains the image
  200. MAKEINTRESOURCE(IDB_CRAPWIZ_16), // name or identifier of image
  201. IMAGE_BITMAP, // type of image
  202. 0, // desired width
  203. 0, // desired height
  204. LR_DEFAULTCOLOR // load flags
  205. ) ) )
  206. {
  207. return E_FAIL;
  208. }
  209. if( NULL == (*hLargeImage = (HBITMAP) LoadImage(
  210. _Module.GetResourceInstance(), // handle of the instance that contains the image
  211. MAKEINTRESOURCE(IDB_CRAPWIZ_32), // name or identifier of image
  212. IMAGE_BITMAP, // type of image
  213. 0, // desired width
  214. 0, // desired height
  215. LR_DEFAULTCOLOR // load flags
  216. ) ) )
  217. {
  218. return E_FAIL;
  219. }
  220. */
  221. return S_OK;
  222. }