SHSetThreadRef function (shlwapi.h)

Stores a per-thread reference to a Component Object Model (COM) object. This allows the caller to control the thread's lifetime so that it can ensure that Windows won't shut down the thread before the caller is ready.

Syntax

LWSTDAPI SHSetThreadRef(
  [in, optional] IUnknown *punk
);

Parameters

[in, optional] punk

Type: IUnknown*

A pointer to the IUnknown of the object for which you want to store a reference. This value can be NULL.

Return value

Type: HRESULT

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

Remarks

Use SHGetThreadRef to retrieve the IUnknown pointer.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (version 5.0 or later); ShCore.dll

See also

SHCreateThread

SHCreateThreadRef

SHGetThreadRef

SHReleaseThreadRef