GetProcessIdOfThread function (Windows)

Switch View :
ScriptFree
GetProcessIdOfThread function

Applies to: desktop apps only

Retrieves the process identifier of the process associated with the specified thread.

Syntax

DWORD WINAPI GetProcessIdOfThread(
  __in  HANDLE Thread
);

Parameters

Thread [in]

A handle to the thread. The handle must have the THREAD_QUERY_INFORMATION or THREAD_QUERY_LIMITED_INFORMATION access right. For more information, see Thread Security and Access Rights.

Windows Server 2003:  The handle must have the THREAD_QUERY_INFORMATION access right.

Return value

If the function succeeds, the return value is the process identifier of the process associated with the specified thread.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Until a process terminates, its process identifier uniquely identifies it on the system. For more information about access rights, see Thread Security and Access Rights.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

GetCurrentThreadId
GetProcessId
GetThreadId
Processes

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012