Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

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 Thread32Firstfunction, set this member to sizeof(THREADENTRY32).

If you do not initialize dwSize, Thread32Firstfails.

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 CreateProcessfunction.

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; do not use.

th32AccessKey

Array of bits. Each bit signifies permission to see the address space of one process.

In the THREADENTRY32structure, 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 GetThreadTimesand other functions that take process handles, the identifiers can be cast directly to process and thread handles.

Requirements

Header tlhelp32.h
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also