IGlobalInterfaceTable::GetInterfaceFromGlobal method (objidl.h)
Retrieves 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(
[in] DWORD dwCookie,
[in] REFIID riid,
[out] void **ppv
);
Parameters
[in] dwCookie
Identifies the interface (and its object), and is retrieved through a call to IGlobalInterfaceTable::RegisterInterfaceInGlobal.
[in] riid
The IID of the interface.
[out] ppv
A pointer to the pointer for the requested interface.
Return value
This method can return the following values.
Return code | Description |
---|---|
|
The method completed successfully. |
|
One or more parameters are invalid. |
Remarks
After an interface has been registered in the global interface table, an apartment can get a pointer to this interface by calling the GetInterfaceFromGlobal method 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 IGlobalInterfaceTable::RevokeInterfaceFromGlobal. That is, the application should ensure that one thread does not call RevokeInterfaceFromGlobal while another thread is calling GetInterfaceFromGlobal with the same cookie. Multiple calls to GetInterfaceFromGlobal for the same cookie are permitted.
The GetInterfaceFromGlobal method calls AddRef on the pointer obtained in the ppv parameter. It is the caller's responsibility to call Release on this pointer.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps | UWP apps] |
Minimum supported server | Windows 2000 Server [desktop apps | UWP apps] |
Target Platform | Windows |
Header | objidl.h (include ObjIdl.h) |