//+------------------------------------------------------------------------- // // Microsoft Windows // // Copyright (C) Microsoft Corporation, 1999 - 1999 // // File: guidhelp.h // //-------------------------------------------------------------------------- #pragma once // GUID support functions class CStr; class CString; struct IContextMenuCallback; struct IComponent; HRESULT ExtractData( IDataObject* piDataObject, CLIPFORMAT cfClipFormat, BYTE* pbData, DWORD cbData ); /*+-------------------------------------------------------------------------* * ExtractString * * Gets string data representing the given clipboard format from the data * object. StringType must be a type that can accept assignment from * LPCTSTR (WTL::CString, CStr, tstring, etc.) *--------------------------------------------------------------------------*/ template HRESULT ExtractString( IDataObject* piDataObject, CLIPFORMAT cfClipFormat, StringType& str); HRESULT GuidToCStr( CStr* pstr, const GUID& guid ); HRESULT GuidToCString(CString* pstr, const GUID& guid ); HRESULT ExtractSnapInCLSID( IDataObject* piDataObject, CLSID* pclsidSnapin ); HRESULT ExtractObjectTypeGUID( IDataObject* piDataObject, GUID* pguidObjectType ); HRESULT ExtractObjectTypeCStr( IDataObject* piDataObject, CStr* pstr ); HRESULT ExtractObjectTypeCString( IDataObject* piDataObject, CString* pstr ); HRESULT LoadRootDisplayName(IComponentData* pIComponentData, CStr& strDisplayName); HRESULT LoadRootDisplayName(IComponentData* pIComponentData, CString& strDisplayName); HRESULT LoadAndAddMenuItem( IContextMenuCallback* pIContextMenuCallback, UINT nResourceID, // contains text and status text seperated by '\n' long lCommandID, long lInsertionPointID, long fFlags, HINSTANCE hInst); HRESULT AddMenuItem( IContextMenuCallback* pIContextMenuCallback, LPOLESTR pszText, LPOLESTR pszStatusBarText, long lCommandID, long lInsertionPointID, long fFlags, HINSTANCE hInst); HRESULT AddSpecialSeparator( IContextMenuCallback* pIContextMenuCallback, long lInsertionPointID = CCM_INSERTIONPOINTID_ROOT_MENU ); HRESULT AddSpecialInsertionPoint( IContextMenuCallback* pIContextMenuCallback, long lCommandID, long lInsertionPointID = CCM_INSERTIONPOINTID_ROOT_MENU ); /*------------------------------------------------*/ /* declare various relational operators for GUIDs */ /*------------------------------------------------*/ #include // template helper CLSID comparison function // NOTE: extra parameter is added to have different decorated function name for each operator // or else in debug version (expanded) functions will be linked as one function template inline bool CompareCLSID (const CLSID& x, const CLSID& y, const comparator * unused = NULL ) { return x.Data1 != y.Data1 ? comparator ()(x.Data1 , y.Data1) : x.Data2 != y.Data2 ? comparator()(x.Data2 , y.Data2) : x.Data3 != y.Data3 ? comparator()(x.Data3 , y.Data3) : comparator()(memcmp(x.Data4 , y.Data4, sizeof(x.Data4)) , 0); } inline bool operator < (const CLSID& x, const CLSID& y) { return CompareCLSID( x , y ); } inline bool operator > (const CLSID& x, const CLSID& y) { return CompareCLSID( x , y ); } inline bool operator <= (const CLSID& x, const CLSID& y) { return CompareCLSID( x , y ); } inline bool operator >= (const CLSID& x, const CLSID& y) { return CompareCLSID( x , y ); } /*--------------------------------------------------------------*/ /* operator== and operator!= for GUIDs are defined in objbase.h */ /*--------------------------------------------------------------*/ #include "guidhelp.inl"