Partager via


THREADENTRY32 (Compact 2013)

3/28/2014

This structure describes an entry from a list that enumerates the threads executing in the system when a snapshot was taken.

Syntax

typedef struct tagTHREADENTRY32 {
  DWORD dwSize;
  DWORD cntUsage;
  DWORD th32ThreadID;
  DWORD th32OwnerProcessID;
  LONG tpBasePri;
  LONG tpDeltaPri;
  DWORD dwFlags;
  DWORD th32AccessKey;
  DWORD th32CurrentProcessID;
  } THREADENTRY32;
  typedef THREADENTRY32* PTHREADENTRY32;
typedef THREADENTRY32* LPTHREADENTRY32;

Members

  • dwSize
    Length, in bytes, of the structure.

    Before calling the Thread32First function, set this member to sizeof(THREADENTRY32).

    If you do not initialize dwSize, Thread32First fails.

  • cntUsage
    Number of references to the thread.

    A thread exists as long as its usage count is nonzero.

    As soon as its usage count becomes zero, a thread terminates.

  • th32ThreadID
    Identifier of the thread.

    This identifier is compatible with the thread identifier returned by the CreateProcess function.

  • th32OwnerProcessID
    Identifier of the process that created the thread.

    The contents of this member can be used by Win32 API elements.

  • tpBasePri
    Initial priority level assigned to a thread, which can be a value from 0 to 255.
  • tpDeltaPri
    Change in the priority level of a thread.

    This value is a signed delta from the base priority level assigned to the thread.

  • dwFlags
    Reserved.
  • th32AccessKey
    Array of bits. Each bit signifies permission to see the address space of one process.

    In the THREADENTRY32 structure, the key contains the bits the thread has, thus defining the processes it can see.

  • th32CurrentProcessID
    Process identifier where the thread is executing.

Remarks

To use the process and thread identifiers with GetThreadTimes and other functions that take process handles, the identifiers can be cast directly to process and thread handles.

Requirements

Header

tlhelp32.h

See Also

Reference

ToolHelp Structures
CreateProcess
Thread32First
GetThreadTimes