Partager via


COM Map Global Functions

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at COM Map Global Functions.

These functions provide support for COM Map IUnknown implementations.

AtlInternalQueryInterface Delegates to the IUnknown of a nonaggregated object.
InlineIsEqualIUnknown Generates efficient code for comparing interfaces against IUnknown.

AtlInternalQueryInterface

Retrieves a pointer to the requested interface.

HRESULT AtlInternalQueryInterface(
    void* pThis,
    const _ATL_INTMAP_ENTRY* pEntries,
    REFIID iid,
    void** ppvObject);

Parameters

pThis
[in] A pointer to the object that contains the COM map of interfaces exposed to QueryInterface.

pEntries
[in] An array of _ATL_INTMAP_ENTRY structures that access a map of available interfaces.

iid
[in] The GUID of the interface being requested.

ppvObject
[out] A pointer to the interface pointer specified in iid, or NULL if the interface is not found.

Return Value

One of the standard HRESULT values.

Remarks

AtlInternalQueryInterface only handles interfaces in the COM map table. If your object is aggregated, AtlInternalQueryInterface does not delegate to the outer unknown. You can enter interfaces into the COM map table with the macro COM_INTERFACE_ENTRY or one of its variants.

Example

// MyTimerProc is a callback function passed to SetTimer()
VOID CALLBACK MyTimerProc(HWND /*hwnd*/, UINT /*uMsg*/, UINT /*idEvent*/, 
   DWORD /*dwTime*/)
{
   LPDISPATCH pDisp = NULL;
   // gpMyCtrl is a global variable of type CMyCtrl*
   // _GetEntries() is a static function you get with BEGIN_COM_MAP()
   AtlInternalQueryInterface (gpMyCtrl, CMyCtrl::_GetEntries(), IID_IDispatch, 
      (LPVOID*)&pDisp);
   //...
   pDisp->Release ();
}

InlineIsEqualIUnknown

Call this function, for the special case of testing for IUnknown.

BOOL InlineIsEqualUnknown(REFGUID rguid1);

Parameters

rguid1
[in] The GUID to compare to IID_IUnknown.

See Also

Functions
COM Map Macros