IGlobalInterfaceTable::GetInterfaceFromGlobal method

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

dwCookie [in]

Identifies the interface (and its object), and is retrieved through a call to IGlobalInterfaceTable::RegisterInterfaceInGlobal.

riid [in]

The IID of the interface.

ppv [out]

A pointer to the pointer for the requested interface.

Return value

This method can return the following values.

Return codeDescription
S_OK

The method completed successfully.

E_INVALIDARG

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

Minimum supported client

Windows 2000 Professional [desktop apps | Windows Store apps]

Minimum supported server

Windows 2000 Server [desktop apps | Windows Store apps]

Header

ObjIdl.h

IDL

ObjIdl.idl

IID

IID_IGlobalInterfaceTable is defined as 00000146-0000-0000-C000-000000000046

See also

IGlobalInterfaceTable

 

 

Community Additions

ADD
Show:
© 2014 Microsoft