SHCreateThreadRef function (shlwapi.h)

Creates a per-thread reference to a Component Object Model (COM) object.

Syntax

LWSTDAPI SHCreateThreadRef(
  [in]  LONG     *pcRef,
  [out] IUnknown **ppunk
);

Parameters

[in] pcRef

Type: LONG*

A pointer to a value, usually a local variable in the thread's ThreadProc, that is used by the interface in ppunk as a reference counter.

[out] ppunk

Type: IUnknown**

The address of a pointer to an IUnknown interface. If successful, this parameter holds the thread's IUnknown pointer on return. Your application is responsible for freeing the pointer when it is finished.

Return value

Type: HRESULT

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

See Managing Thread References for more details on using the Shlwapi thread APIs.

Requirements

Requirement Value
Minimum supported client Windows XP with SP2 [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (version 6.0 or later)

See also

SHCreateThread

SHGetThreadRef

SHReleaseThreadRef

SHSetThreadRef