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.

121 lines
3.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: guidhelp.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #pragma once
  11. // GUID support functions
  12. class CStr;
  13. class CString;
  14. struct IContextMenuCallback;
  15. struct IComponent;
  16. HRESULT ExtractData( IDataObject* piDataObject,
  17. CLIPFORMAT cfClipFormat,
  18. BYTE* pbData,
  19. DWORD cbData );
  20. /*+-------------------------------------------------------------------------*
  21. * ExtractString
  22. *
  23. * Gets string data representing the given clipboard format from the data
  24. * object. StringType must be a type that can accept assignment from
  25. * LPCTSTR (WTL::CString, CStr, tstring, etc.)
  26. *--------------------------------------------------------------------------*/
  27. template<class StringType>
  28. HRESULT ExtractString( IDataObject* piDataObject,
  29. CLIPFORMAT cfClipFormat,
  30. StringType& str);
  31. HRESULT GuidToCStr( CStr* pstr, const GUID& guid );
  32. HRESULT GuidToCString(CString* pstr, const GUID& guid );
  33. HRESULT ExtractSnapInCLSID( IDataObject* piDataObject, CLSID* pclsidSnapin );
  34. HRESULT ExtractObjectTypeGUID( IDataObject* piDataObject, GUID* pguidObjectType );
  35. HRESULT ExtractObjectTypeCStr( IDataObject* piDataObject, CStr* pstr );
  36. HRESULT ExtractObjectTypeCString( IDataObject* piDataObject, CString* pstr );
  37. HRESULT LoadRootDisplayName(IComponentData* pIComponentData, CStr& strDisplayName);
  38. HRESULT LoadRootDisplayName(IComponentData* pIComponentData, CString& strDisplayName);
  39. HRESULT LoadAndAddMenuItem(
  40. IContextMenuCallback* pIContextMenuCallback,
  41. UINT nResourceID, // contains text and status text seperated by '\n'
  42. long lCommandID,
  43. long lInsertionPointID,
  44. long fFlags,
  45. HINSTANCE hInst);
  46. HRESULT AddMenuItem(
  47. IContextMenuCallback* pIContextMenuCallback,
  48. LPOLESTR pszText,
  49. LPOLESTR pszStatusBarText,
  50. long lCommandID,
  51. long lInsertionPointID,
  52. long fFlags,
  53. HINSTANCE hInst);
  54. HRESULT AddSpecialSeparator(
  55. IContextMenuCallback* pIContextMenuCallback,
  56. long lInsertionPointID = CCM_INSERTIONPOINTID_ROOT_MENU );
  57. HRESULT AddSpecialInsertionPoint(
  58. IContextMenuCallback* pIContextMenuCallback,
  59. long lCommandID,
  60. long lInsertionPointID = CCM_INSERTIONPOINTID_ROOT_MENU );
  61. /*------------------------------------------------*/
  62. /* declare various relational operators for GUIDs */
  63. /*------------------------------------------------*/
  64. #include <functional>
  65. // template helper CLSID comparison function
  66. // NOTE: extra parameter is added to have different decorated function name for each operator
  67. // or else in debug version (expanded) functions will be linked as one function
  68. template <typename comparator>
  69. inline bool CompareCLSID (const CLSID& x, const CLSID& y, const comparator * unused = NULL )
  70. {
  71. return x.Data1 != y.Data1 ? comparator<unsigned long> ()(x.Data1 , y.Data1) :
  72. x.Data2 != y.Data2 ? comparator<unsigned short>()(x.Data2 , y.Data2) :
  73. x.Data3 != y.Data3 ? comparator<unsigned short>()(x.Data3 , y.Data3) :
  74. comparator<int>()(memcmp(x.Data4 , y.Data4, sizeof(x.Data4)) , 0);
  75. }
  76. inline bool operator < (const CLSID& x, const CLSID& y)
  77. {
  78. return CompareCLSID<std::less>( x , y );
  79. }
  80. inline bool operator > (const CLSID& x, const CLSID& y)
  81. {
  82. return CompareCLSID<std::greater>( x , y );
  83. }
  84. inline bool operator <= (const CLSID& x, const CLSID& y)
  85. {
  86. return CompareCLSID<std::less_equal>( x , y );
  87. }
  88. inline bool operator >= (const CLSID& x, const CLSID& y)
  89. {
  90. return CompareCLSID<std::greater_equal>( x , y );
  91. }
  92. /*--------------------------------------------------------------*/
  93. /* operator== and operator!= for GUIDs are defined in objbase.h */
  94. /*--------------------------------------------------------------*/
  95. #include "guidhelp.inl"