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.

140 lines
2.9 KiB

  1. /*++
  2. Copyright (c) 1994-1998 Microsoft Corporation
  3. Module Name :
  4. menuex.h
  5. Abstract:
  6. Menu helper classes
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #ifndef _MENUEX_H
  14. #define _MENUEX_H
  15. //
  16. // Forward Definitions
  17. //
  18. class CIISObject;
  19. class CIISItemInfo;
  20. class CISMShellExecutable : public CObjectPlus
  21. /*++
  22. Class Description:
  23. Executable object. This may be a shell document, or an executable
  24. Public Interface:
  25. CShellExecutable : Constructor for executable object
  26. Execute : Execute the add-on-tool
  27. QueryToolTipsText : Get the tooltips text
  28. HasIcon : Icon was loaded
  29. GetIcon : Get icon handle
  30. ShowInToolBar : Whether or not the item is to be shown in the toolbar
  31. InitializedOK : TRUE if the object initialized ok
  32. --*/
  33. {
  34. public:
  35. //
  36. // Constructor
  37. //
  38. CISMShellExecutable(
  39. IN LPCTSTR lpszRegistryValue,
  40. IN int nBitmapID,
  41. IN int nCmd
  42. );
  43. ~CISMShellExecutable();
  44. public:
  45. //
  46. // Execute with current selection or
  47. // no parameters
  48. //
  49. DWORD Execute(
  50. IN LPCTSTR lpszServer = NULL,
  51. IN LPCTSTR lpszService = NULL
  52. );
  53. LPCTSTR GetToolTipsText(
  54. CString & str,
  55. IN LPCTSTR lpstrServer = NULL,
  56. IN LPCTSTR lpstrService = NULL
  57. );
  58. BOOL HasIcon() const { return m_hIcon != NULL; }
  59. HICON GetIcon() const { return m_hIcon; }
  60. BOOL HasBitmap() const { return m_pBitmap != NULL; }
  61. BOOL InitializedOK() const { return !m_strCommand.IsEmpty(); }
  62. BOOL ShowInToolBar() const { return m_fShowInToolbar; }
  63. MMCBUTTON * GetButton() { return m_pmmcButton; }
  64. HBITMAP GetBitmap() { ASSERT(m_pBitmap); return (HBITMAP)*m_pBitmap; }
  65. int GetBitmapIndex() const { return m_nBitmapID; }
  66. protected:
  67. static void ExtractBitmapFromIcon(
  68. IN HICON hIcon,
  69. OUT CBitmap *& pBitmap
  70. );
  71. static HICON GetShellIcon(
  72. IN LPCTSTR lpszShellExecutable
  73. );
  74. static HICON ExtractIcon(
  75. IN LPCTSTR lpszIconSource,
  76. IN UINT nIconOffset = 0
  77. );
  78. static LPTSTR GetField(
  79. IN LPTSTR pchLine = NULL
  80. );
  81. static DWORD ExpandEscapeCodes(
  82. OUT CString & strDest,
  83. IN LPCTSTR lpSrc,
  84. IN LPCTSTR lpszComputer = NULL,
  85. IN LPCTSTR lpszService = NULL
  86. );
  87. protected:
  88. static const TCHAR s_chField;
  89. static const TCHAR s_chEscape;
  90. static const TCHAR s_chService;
  91. static const TCHAR s_chComputer;
  92. private:
  93. int m_nBitmapID;
  94. int m_nCmd;
  95. HICON m_hIcon;
  96. BOOL m_fShowInToolbar;
  97. CString m_strCommand;
  98. CString m_strDefaultDirectory;
  99. CString m_strParms;
  100. CString m_strNoSelectionParms;
  101. CString m_strToolTipsText;
  102. CBitmap * m_pBitmap;
  103. MMCBUTTON * m_pmmcButton;
  104. };
  105. #endif // _MENUEX_H