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.

123 lines
3.0 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2001.
  5. //
  6. // File:
  7. //
  8. // Contents: About Pane
  9. //
  10. //
  11. // History: TaroonM
  12. // 10/30/01
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "stdafx.h"
  16. #include "about.h"
  17. #ifdef _DEBUG
  18. #define new DEBUG_NEW
  19. #undef THIS_FILE
  20. static char THIS_FILE[] = __FILE__;
  21. #endif
  22. // TODO: none of this CSnapinAboutImpl code appears to be working
  23. CSnapinAboutImpl::CSnapinAboutImpl()
  24. {
  25. }
  26. CSnapinAboutImpl::~CSnapinAboutImpl()
  27. {
  28. }
  29. HRESULT CSnapinAboutImpl::AboutHelper(UINT nID, CString* pAddString, LPOLESTR* lpPtr)
  30. {
  31. if (lpPtr == NULL)
  32. return E_POINTER;
  33. CString s;
  34. // Needed for Loadstring
  35. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  36. s.LoadString(nID);
  37. if (pAddString != NULL)
  38. {
  39. s += *pAddString;
  40. }
  41. *lpPtr = reinterpret_cast<LPOLESTR>(CoTaskMemAlloc((s.GetLength() + 1)* sizeof(wchar_t)));
  42. if (*lpPtr == NULL)
  43. return E_OUTOFMEMORY;
  44. lstrcpy(*lpPtr, (LPCTSTR)s);
  45. return S_OK;
  46. }
  47. STDMETHODIMP CSnapinAboutImpl::GetSnapinDescription(LPOLESTR* lpDescription)
  48. {
  49. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  50. return AboutHelper(IDS_DESCRIPTION, lpDescription);
  51. }
  52. STDMETHODIMP CSnapinAboutImpl::GetProvider(LPOLESTR* lpName)
  53. {
  54. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  55. return AboutHelper(IDS_COMPANY, lpName);
  56. }
  57. STDMETHODIMP CSnapinAboutImpl::GetSnapinVersion(LPOLESTR* lpVersion)
  58. {
  59. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  60. CString strAddString;
  61. strAddString.LoadString (IDS_ABOUTGLUESTRING);
  62. return AboutHelper(IDS_VERSION, lpVersion);
  63. }
  64. STDMETHODIMP CSnapinAboutImpl::GetSnapinImage(HICON* hAppIcon)
  65. {
  66. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  67. if (hAppIcon == NULL)
  68. return E_POINTER;
  69. *hAppIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_APPICON));
  70. ASSERT(*hAppIcon != NULL);
  71. return (*hAppIcon != NULL) ? S_OK : E_FAIL;
  72. }
  73. STDMETHODIMP CSnapinAboutImpl::GetStaticFolderImage(HBITMAP* hSmallImage,
  74. HBITMAP* hSmallImageOpen,
  75. HBITMAP* hLargeImage,
  76. COLORREF* cLargeMask)
  77. {
  78. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  79. if ((hSmallImage == NULL)
  80. || (hSmallImageOpen == NULL)
  81. || (hLargeImage == NULL)
  82. || (cLargeMask == NULL))
  83. return E_POINTER;
  84. *hSmallImage = LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_16x16));
  85. *hSmallImageOpen = LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_16x16));
  86. *hLargeImage = LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_32x32));
  87. *cLargeMask = RGB(255, 0, 255);
  88. return S_OK;
  89. }
  90.