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.

110 lines
3.2 KiB

  1. //==============================================================;
  2. //
  3. // This source code is only intended as a supplement to existing Microsoft documentation.
  4. //
  5. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  6. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  7. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  8. // PURPOSE.
  9. //
  10. // Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  11. //==============================================================;
  12. // About.cpp : Implementation of CAbout
  13. #include "stdafx.h"
  14. #include "ExtSnap.h"
  15. #include "About.h"
  16. #include "resource.h"
  17. #include "globals.h"
  18. #include <crtdbg.h>
  19. CAbout::CAbout()
  20. : m_cref(0)
  21. {
  22. m_hSmallImage = (HBITMAP)LoadImage(g_hinst, MAKEINTRESOURCE(IDB_SMBMP), IMAGE_BITMAP, 16, 16, LR_LOADTRANSPARENT);
  23. m_hLargeImage = (HBITMAP)LoadImage(g_hinst, MAKEINTRESOURCE(IDB_LGBMP), IMAGE_BITMAP, 32, 32, LR_LOADTRANSPARENT);
  24. m_hSmallImageOpen = (HBITMAP)LoadImage(g_hinst, MAKEINTRESOURCE(IDB_SMOPEN), IMAGE_BITMAP, 16, 16, LR_LOADTRANSPARENT);
  25. m_hAppIcon = LoadIcon(g_hinst, MAKEINTRESOURCE(IDI_ICON1));
  26. }
  27. CAbout::~CAbout()
  28. {
  29. if (m_hSmallImage != NULL)
  30. DeleteObject(m_hSmallImage);
  31. if (m_hLargeImage != NULL)
  32. DeleteObject(m_hLargeImage);
  33. if (m_hSmallImageOpen != NULL)
  34. DeleteObject(m_hSmallImageOpen);
  35. if (m_hAppIcon != NULL)
  36. DeleteObject(m_hAppIcon);
  37. m_hSmallImage = NULL;
  38. m_hLargeImage = NULL;
  39. m_hSmallImageOpen = NULL;
  40. m_hAppIcon = NULL;
  41. }
  42. ///////////////////////////////
  43. // Interface ISnapinAbout
  44. ///////////////////////////////
  45. STDMETHODIMP CAbout::GetSnapinDescription(
  46. /* [out] */ LPOLESTR *lpDescription)
  47. {
  48. return AllocOleStr(lpDescription,
  49. _T("ATL-based Namespace Extension Sample \
  50. Snap-in for the Computer Management snap-in."));
  51. }
  52. STDMETHODIMP CAbout::GetProvider(
  53. /* [out] */ LPOLESTR *lpName)
  54. {
  55. return AllocOleStr(lpName, _T("Copyright � 1998 Microsoft Corporation"));
  56. }
  57. STDMETHODIMP CAbout::GetSnapinVersion(
  58. /* [out] */ LPOLESTR *lpVersion)
  59. {
  60. return AllocOleStr(lpVersion, _T("1.0"));
  61. }
  62. STDMETHODIMP CAbout::GetSnapinImage(
  63. /* [out] */ HICON *hAppIcon)
  64. {
  65. *hAppIcon = m_hAppIcon;
  66. if (*hAppIcon == NULL)
  67. return E_FAIL;
  68. else
  69. return S_OK;
  70. }
  71. STDMETHODIMP CAbout::GetStaticFolderImage(
  72. /* [out] */ HBITMAP *hSmallImage,
  73. /* [out] */ HBITMAP *hSmallImageOpen,
  74. /* [out] */ HBITMAP *hLargeImage,
  75. /* [out] */ COLORREF *cMask)
  76. {
  77. *hSmallImage = m_hSmallImage;
  78. *hLargeImage = m_hLargeImage;
  79. *hSmallImageOpen = m_hSmallImageOpen;
  80. *cMask = RGB(0, 128, 128);
  81. if (*hSmallImage == NULL || *hLargeImage == NULL || *hSmallImageOpen == NULL)
  82. return E_FAIL;
  83. else
  84. return S_OK;
  85. }