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.

109 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. // CCAbout.cpp : Implementation of CCAbout
  13. #include "stdafx.h"
  14. #include "EvtVwr.h"
  15. #include "CAbout.h"
  16. #include "resource.h"
  17. #include "globals.h"
  18. #include <crtdbg.h>
  19. CCAbout::CCAbout()
  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. CCAbout::~CCAbout()
  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 CCAbout::GetSnapinDescription(
  46. /* [out] */ LPOLESTR *lpDescription)
  47. {
  48. return AllocOleStr(lpDescription,
  49. _T("Sample Z3: ATL-based Event Viewer Sample"));
  50. }
  51. STDMETHODIMP CCAbout::GetProvider(
  52. /* [out] */ LPOLESTR *lpName)
  53. {
  54. return AllocOleStr(lpName, _T("Copyright � 1999 Microsoft Corporation"));
  55. }
  56. STDMETHODIMP CCAbout::GetSnapinVersion(
  57. /* [out] */ LPOLESTR *lpVersion)
  58. {
  59. return AllocOleStr(lpVersion, _T("1.0"));
  60. }
  61. STDMETHODIMP CCAbout::GetSnapinImage(
  62. /* [out] */ HICON *hAppIcon)
  63. {
  64. *hAppIcon = m_hAppIcon;
  65. if (*hAppIcon == NULL)
  66. return E_FAIL;
  67. else
  68. return S_OK;
  69. }
  70. STDMETHODIMP CCAbout::GetStaticFolderImage(
  71. /* [out] */ HBITMAP *hSmallImage,
  72. /* [out] */ HBITMAP *hSmallImageOpen,
  73. /* [out] */ HBITMAP *hLargeImage,
  74. /* [out] */ COLORREF *cMask)
  75. {
  76. *hSmallImage = m_hSmallImage;
  77. *hLargeImage = m_hLargeImage;
  78. *hSmallImageOpen = m_hSmallImageOpen;
  79. *cMask = RGB(0, 128, 128);
  80. if (*hSmallImage == NULL || *hLargeImage == NULL || *hSmallImageOpen == NULL)
  81. return E_FAIL;
  82. else
  83. return S_OK;
  84. }