Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This method supplies a pointer to an interface on an object that is usable by the calling apartment. This interface must be currently registered in the global interface table.
Syntax
HRESULT GetInterfaceFromGlobal( DWORD dwCookie, REFIID riid, void** ppv ); |
Parameters
- dwCookie
-
[in] DWORDcookie identifying the interface (and its object), retrieved through a call to the IGlobalInterfaceTable::RegisterInterfaceInGlobalmethod.
- riid
-
[in] IID of the desired interface. This parameter must match the IID passed in IGlobalInterfaceTable::RegisterInterfaceInGlobal.
- ppv
-
[out, iid_is( riid)] Pointer to the requested interface pointer.
Return Value
If the method succeeds, the method returns S_OK. Otherwise, if one or more of the parameters are invalid, the method returns E_INVALIDARG.
Remarks
After an interface has been registered in the global interface table, an apartment can get a pointer to this interface by calling the IGlobalInterfaceTable::GetInterfaceFromGlobalmethod with the supplied cookie.
This pointer to the interface can be used in the calling apartment but not by other apartments in the process.
The application is responsible for coordinating access to the global variable during calls to the IGlobalInterfaceTable::RevokeInterfaceFromGlobalmethod.
The application should ensure that one thread does not call RevokeInterfaceFromGlobalwhile another thread is calling GetInterfaceFromGlobalwith the same cookie.
Multiple calls to GetInterfaceFromGlobalfor the same cookie are permitted.
The GetInterfaceFromGlobalmethod calls the IUnknown::AddRefmethod on the pointer obtained in the ppvparameter. It is the caller's responsibility to call the IUnknown::Releasemethod on this pointer.
To determine whether the platform supports this interface, see Determining Supported COM APIs.
Requirements
Header | objidl.h, objidl.idl |
Library | ole32.lib, uuid.lib |
Windows Embedded CE | Windows CE 3.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |