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.

93 lines
2.7 KiB

  1. /////////////////////////////////////////////////////////////////////
  2. // StdAbout.cpp
  3. //
  4. // Implementation of the ISnapinAbout interface
  5. //
  6. // HISTORY
  7. // 31-Jul-97 t-danm Creation.
  8. /////////////////////////////////////////////////////////////////////
  9. #include "stdutils.h" // HrLoadOleString()
  10. CSnapinAbout::CSnapinAbout()
  11. : m_hSmallImage (0),
  12. m_hSmallImageOpen (0),
  13. m_hLargeImage (0)
  14. {
  15. }
  16. CSnapinAbout::~CSnapinAbout()
  17. {
  18. if ( m_hSmallImage )
  19. ::DeleteObject (m_hSmallImage);
  20. if ( m_hSmallImageOpen )
  21. ::DeleteObject (m_hSmallImageOpen);
  22. if ( m_hLargeImage )
  23. ::DeleteObject (m_hLargeImage);
  24. }
  25. STDMETHODIMP CSnapinAbout::GetSnapinDescription(OUT LPOLESTR __RPC_FAR *lpDescription)
  26. {
  27. return HrLoadOleString(m_uIdStrDestription, OUT lpDescription);
  28. }
  29. STDMETHODIMP CSnapinAbout::GetProvider(OUT LPOLESTR __RPC_FAR *lpName)
  30. {
  31. return HrCopyToOleString(m_szProvider, OUT lpName);
  32. }
  33. STDMETHODIMP CSnapinAbout::GetSnapinVersion(OUT LPOLESTR __RPC_FAR *lpVersion)
  34. {
  35. return HrCopyToOleString(m_szVersion, OUT lpVersion);
  36. }
  37. STDMETHODIMP CSnapinAbout::GetSnapinImage(OUT HICON __RPC_FAR *hAppIcon)
  38. {
  39. if (hAppIcon == NULL)
  40. return E_POINTER;
  41. AFX_MANAGE_STATE(AfxGetStaticModuleState()); // Required for AfxGetInstanceHandle()
  42. *hAppIcon = ::LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(m_uIdIconImage));
  43. if (*hAppIcon == NULL)
  44. {
  45. ASSERT(FALSE && "Unable to load icon");
  46. return E_FAIL;
  47. }
  48. return S_OK;
  49. }
  50. STDMETHODIMP CSnapinAbout::GetStaticFolderImage(
  51. OUT HBITMAP __RPC_FAR *hSmallImage,
  52. OUT HBITMAP __RPC_FAR *hSmallImageOpen,
  53. OUT HBITMAP __RPC_FAR *hLargeImage,
  54. OUT COLORREF __RPC_FAR *crMask)
  55. {
  56. ASSERT(hSmallImage != NULL);
  57. ASSERT(hSmallImageOpen != NULL);
  58. ASSERT(hLargeImage != NULL);
  59. ASSERT(crMask != NULL);
  60. AFX_MANAGE_STATE(AfxGetStaticModuleState()); // Required for AfxGetInstanceHandle()
  61. HINSTANCE hInstance = AfxGetInstanceHandle();
  62. if ( !m_hSmallImage )
  63. m_hSmallImage = ::LoadBitmap(hInstance, MAKEINTRESOURCE(m_uIdBitmapSmallImage));
  64. if ( !m_hSmallImageOpen )
  65. m_hSmallImageOpen = ::LoadBitmap(hInstance, MAKEINTRESOURCE(m_uIdBitmapSmallImageOpen));
  66. if ( !m_hLargeImage )
  67. m_hLargeImage = ::LoadBitmap(hInstance, MAKEINTRESOURCE(m_uIdBitmapLargeImage));
  68. *hSmallImage = m_hSmallImage;
  69. *hSmallImageOpen = m_hSmallImageOpen;
  70. *hLargeImage = m_hLargeImage;
  71. *crMask = m_crImageMask;
  72. #ifdef _DEBUG
  73. if (NULL == *hSmallImage || NULL == *hSmallImageOpen || NULL == *hLargeImage)
  74. {
  75. TRACE0("WRN: CSnapinAbout::GetStaticFolderImage() - Unable to load all the bitmaps.\n");
  76. return E_FAIL;
  77. }
  78. #endif
  79. return S_OK;
  80. }