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.

144 lines
4.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: about.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _ABOUT_H
  11. #define _ABOUT_H
  12. #include "util.h"
  13. class CSnapinAbout;
  14. SC ScSetDescriptionUIText(HWND hwndSnapinDescEdit, LPCTSTR lpszDescription);
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CSnapinAboutDialog
  17. class CSnapinAboutDialog : public CDialogImpl<CSnapinAboutDialog>
  18. {
  19. typedef CSnapinAboutDialog ThisClass;
  20. typedef CDialogImpl<CSnapinAboutDialog> BaseClass;
  21. public:
  22. enum { IDD = IDD_SNAPIN_ABOUT };
  23. CSnapinAboutDialog(CSnapinAbout *pSnapinAbout) : m_pAboutInfo(pSnapinAbout) {}
  24. BEGIN_MSG_MAP(ThisClass)
  25. MESSAGE_HANDLER (WM_INITDIALOG, OnInitDialog)
  26. COMMAND_ID_HANDLER (IDOK, OnOK)
  27. COMMAND_ID_HANDLER (IDCANCEL, OnCancel)
  28. END_MSG_MAP()
  29. protected:
  30. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  31. LRESULT OnOK (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  32. LRESULT OnCancel (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  33. private:
  34. CSnapinAbout* m_pAboutInfo;
  35. WTL::CStatic m_hIcon;
  36. WTL::CEdit m_SnapinInfo;
  37. WTL::CEdit m_SnapinDesc;
  38. };
  39. class CSnapinAbout
  40. {
  41. // smart handle for icons
  42. class CIcon
  43. {
  44. public:
  45. CIcon() : m_hIcon(NULL) {}
  46. ~CIcon() { DeleteObject(); }
  47. void Attach(HICON hIcon) { DeleteObject(); m_hIcon = hIcon; }
  48. operator HICON() { return m_hIcon; }
  49. void DeleteObject() { if (m_hIcon != NULL) ::DestroyIcon(m_hIcon); m_hIcon = NULL; }
  50. private:
  51. HICON m_hIcon;
  52. };
  53. // smart pointer for CoTaskMem allocated OLESTR
  54. typedef CCoTaskMemPtr<OLECHAR> CCtmOleStrPtr;
  55. // Constructor/Destructor
  56. public:
  57. CSnapinAbout();
  58. // Interfaces
  59. public:
  60. void ShowAboutBox();
  61. BOOL GetBasicInformation(CLSID& clsid)
  62. { return GetInformation(clsid, BASIC_INFO); }
  63. BOOL GetSnapinInformation(CLSID& clsid)
  64. { return GetInformation(clsid, FULL_INFO); }
  65. BOOL HasBasicInformation() {return m_bBasicInfo;}
  66. BOOL HasInformation() {return m_bFullInfo;}
  67. void GetSmallImages(HBITMAP* hImage, HBITMAP* hImageOpen, COLORREF* cMask)
  68. {
  69. *hImage = m_SmallImage;
  70. *hImageOpen = m_SmallImageOpen;
  71. *cMask = m_cMask;
  72. }
  73. void GetLargeImage(HBITMAP* hImage, COLORREF* cMask)
  74. {
  75. *hImage = m_LargeImage;
  76. *cMask = m_cMask;
  77. }
  78. const LPOLESTR GetCompanyName() {return m_lpszCompanyName;};
  79. const LPOLESTR GetDescription() {return m_lpszDescription;};
  80. const LPOLESTR GetVersion() {return m_lpszVersion;};
  81. const LPOLESTR GetSnapinName() {return m_lpszSnapinName;};
  82. const HICON GetSnapinIcon() { return m_AppIcon; }
  83. const HRESULT GetObjectStatus() { return m_hrObjectStatus; }
  84. public: // Not published by about object, name derived from console
  85. void SetSnapinName(LPCOLESTR lpszName)
  86. {
  87. ASSERT(lpszName != NULL);
  88. m_lpszSnapinName.Delete(); // delete any existing name
  89. m_lpszSnapinName.Attach(CoTaskDupString(lpszName));
  90. }
  91. private:
  92. void CommonContruct();
  93. enum INFORMATION_TYPE
  94. {
  95. BASIC_INFO,
  96. FULL_INFO
  97. };
  98. BOOL GetInformation(CLSID& clsid, int nType);
  99. // Attributes
  100. private:
  101. BOOL m_bBasicInfo; // TRUE if basic info is loaded
  102. BOOL m_bFullInfo; // TRUE if all snapin info is loaded
  103. CCtmOleStrPtr m_lpszSnapinName; // Snap-in name Note: this is not exposed by the snap-in.
  104. CCtmOleStrPtr m_lpszCompanyName; // Company Name (Provider)
  105. CCtmOleStrPtr m_lpszDescription; // Description box text
  106. CCtmOleStrPtr m_lpszVersion; // Version string
  107. CIcon m_AppIcon; // Property page icon
  108. WTL::CBitmap m_SmallImage; // Small image for scope and result pane
  109. WTL::CBitmap m_SmallImageOpen; // Open image for scope pane.
  110. WTL::CBitmap m_LargeImage; // Large image for result pane
  111. COLORREF m_cMask;
  112. HRESULT m_hrObjectStatus; // Result from object creation
  113. };
  114. #endif
  115. /////////////////////////////////////////////////////////////////////////////