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.

128 lines
4.3 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. #if _MSC_VER <= 1300
  67. // NOTE: extra parameter is added to have different decorated function name for each operator
  68. // or else in debug version (expanded) functions will be linked as one function
  69. // NOTE: VC7 supports template template parameters, which T really should be, but they don't
  70. // work here. The compiler shouldn't even allow this code, but somehow it magically works.
  71. template <class comparator>
  72. inline bool CompareCLSID (const CLSID& x, const CLSID& y, const comparator * unused = NULL)
  73. #else
  74. template <template <class T> class comparator>
  75. inline bool CompareCLSID (const CLSID& x, const CLSID& y)
  76. #endif
  77. {
  78. return x.Data1 != y.Data1 ? comparator<unsigned long> ()(x.Data1 , y.Data1) :
  79. x.Data2 != y.Data2 ? comparator<unsigned short>()(x.Data2 , y.Data2) :
  80. x.Data3 != y.Data3 ? comparator<unsigned short>()(x.Data3 , y.Data3) :
  81. comparator<int>()(memcmp(x.Data4 , y.Data4, sizeof(x.Data4)) , 0);
  82. }
  83. inline bool operator < (const CLSID& x, const CLSID& y)
  84. {
  85. return CompareCLSID<std::less>( x , y );
  86. }
  87. inline bool operator > (const CLSID& x, const CLSID& y)
  88. {
  89. return CompareCLSID<std::greater>( x , y );
  90. }
  91. inline bool operator <= (const CLSID& x, const CLSID& y)
  92. {
  93. return CompareCLSID<std::less_equal>( x , y );
  94. }
  95. inline bool operator >= (const CLSID& x, const CLSID& y)
  96. {
  97. return CompareCLSID<std::greater_equal>( x , y );
  98. }
  99. /*--------------------------------------------------------------*/
  100. /* operator== and operator!= for GUIDs are defined in objbase.h */
  101. /*--------------------------------------------------------------*/
  102. #include "guidhelp.inl"