CoGetApplicationThreadReference function

Gets a reference to the current ASTA thread to participate in ASTA cooperative lifetime management.

Syntax

HRESULT WINOLEAPI CoGetApplicationThreadReference(
  _Out_ IUnknown **ppThreadReference
);

Parameters

  • ppThreadReference [out]
    Receives the IUnknown interface for the thread lifetime object.

Return value

This function can return one of these values.

Return code Description
S_OK

The call was successful.

CO_E_NOTSUPPORTED

The CoGetApplicationThreadReference function was called from an MTA or classic STA thread.

 

Remarks

This function is supported only in an ASTA, where it supports the ASTA lifetime pattern.

The thread reference object returned by this function should be stored as a field in an STA object. It can't be marshaled or stored in the Global Interface Table, and it fails quickly if called from the wrong thread.

Requirements

Header

Combaseapi.h

DLL

Combase.dll