GetThreadDescription function
Retrieves the description that was assigned to a thread by calling SetThreadDescription.
Syntax
HRESULT WINAPI GetThreadDescription( _In_ HANDLE hThread, _Out_ PWSTR *threadDescription );
Parameters
- hThread [in]
-
A handle to the thread for which to retrieve the description. The handle must have THREAD_QUERY_LIMITED_INFORMATION access.
- threadDescription [out]
-
A Unicode string that contains the description of the thread.
Return value
If the function succeeds, the return value is the HRESULT that denotes a successful operation. If the function fails, the return value is an HRESULT that denotes the error.
Remarks
The description for a thread can change at any time. For example, a different thread can change the description of a thread of interest while you try to retrieve that description.
Thread descriptions do not need to be unique.
To free the memory for the thread description, call the LocalFree method.
Examples
The following example gets the description for a thread, prints the description, and then frees the memory for the description.
HRESULT hr = GetThreadDescription(ThreadHandle, &data);
if (SUCCEEDED(hr))
{
wprintf(“%ls\m”, data);
LocalFree(data);
}
Requirements
|
Minimum supported client |
Windows 10, version 1607 [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2016 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also