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.
A version of this page is also available for
4/8/2010

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.

Syntax

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

Parameters

pUnk

[in] Interface pointer of type riidon 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 DWORDcookie that can be used by another apartment to get access to a pointer to the interface being registered.

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

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::GetInterfaceFromGlobalmethod 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::RevokeInterfaceFromGlobalmethod.

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

See Also