IGlobalInterfaceTable::GetInterfaceFromGlobal

[New for Windows NT 4.0 Service Pack 3.]

Supplies a pointer to an interface on an object registered in the global table that is usable by the calling apartment.

HRESULT GetInterfaceFromGlobal(
  DWORD  dwCookie,  //Cookie identifying the desired global 
                    //interface and its object
  REFIID  riid,     //IID of the registered global interface
  void **ppv        //Indirect pointer to the desired interface
);
 

Parameters

dwCookie
[in] DWORD cookie identifying the interface (and its object), retrieved through a call to IGlobalInterfaceTable::RegisterInterfaceInGlobal.
riid
[in] IID of the desired interface. This parameter must match the IID passed in RegisterInterfaceInGlobal.
ppv
[out, iid_is(riid)] Pointer to the requested interface pointer.

Return Values

S_OK
The operation was successful.
E_INVALIDARG
One or more parameters are invalid.

Remarks

An apartment that wants a pointer to this interface then calls the GetInterfaceFromGlobal method with this cookie, and the implementation then, in the proper way, supplies a pointer to the interface that can be used in the calling apartment. The interface pointer supplied cannot be used by other apartments in the process.

The application is responsible for coordinating access to the global variable during calls to 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.'

GetInterfaceFromGlobal calls IUnknown::AddRef on the pointer obtained in ppv. It is the caller's responsibility to call Release on this pointer.

QuickInfo

  Windows NT: Use version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in objidl.h.

See Also

IGlobalInterfaceTable::RegisterInterfaceInGlobal, IGlobalInterfaceTable::RevokeInterfaceFromGlobal