IGlobalInterfaceTable::RegisterInterfaceInGlobal

This method registers a specified interface on an object residing in one apartment of a process as a global (process-wide) interface, allowing other apartments access to that interface.

HRESULT RegisterInterfaceInGlobal(
  IUnknown* pUnk, 
  REFIID riid, 
  DWORD* pdwCookie
);

Parameters

  • pUnk
    [in] Interface pointer of type riid on the object on which the interface to be registered as global is implemented.
  • riid
    [in] IID of the interface to be registered as global.
  • pdwCookie
    [out] Pointer to a DWORD cookie that can be used by another apartment to get access to a pointer to the interface being registered.

Return Values

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

This method is called in the apartment in which an object resides to register one of the object's interfaces as a global (process-wide) interface. This method supplies a pointer to a cookie that other apartments can use in a call to the IGlobalInterfaceTable::GetInterfaceFromGlobal method to get a pointer to that interface.

The interface pointer may be a pointer to an in-process object, or it may be a pointer to a proxy for an object residing in another apartment, in another process, or on another machine.

The apartment that calls this method must remain alive until the corresponding call to the IGlobalInterfaceTable::RevokeInterfaceFromGlobal method.

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

OS Versions: Windows CE 3.0 and later.
Header: Objidl.h, Objidl.idl.
Link Library: Ole32.lib, Uuid.lib.

See Also

IGlobalInterfaceTable::RevokeInterfaceFromGlobal | IGlobalInterfaceTable::GetInterfaceFromGlobal

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.