Takes a snapshot of the processes and the heaps, modules, and threads used by the processes.
HANDLE WINAPI CreateToolhelp32Snapshot(
DWORD dwFlags,
DWORD th32ProcessID
);
Value | Meaning |
---|---|
TH32CS_INHERIT | Indicates that the snapshot handle is to be inheritable. |
TH32CS_SNAPALL | Equivalent to specifying TH32CS_SNAPHEAPLIST, TH32CS_SNAPMODULE, TH32CS_SNAPPROCESS, and TH32CS_SNAPTHREAD. |
TH32CS_SNAPHEAPLIST | Includes the heap list of the specified process in the snapshot. |
TH32CS_SNAPMODULE | Includes the module list of the specified process in the snapshot. |
TH32CS_SNAPPROCESS | Includes the process list in the snapshot. |
TH32CS_SNAPTHREAD | Includes the thread list in the snapshot. |
Returns an open handle to the specified snapshot if successful or – 1 otherwise.
The snapshot taken by this function is examined by the other tool help functions to provide their results. Access to the snapshot is read only. The snapshot handle acts like an object handle and is subject to the same rules regarding which processes and threads it is valid in.
To retrieve an extended error status code generated by this function, use the GetLastError function.
To destroy the snapshot, use the CloseHandle function.
Windows NT: Requires version 5.0 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in tlhelp32.h.
Import Library: Use kernel32.lib.
Tool Help Library Overview, Tool Help Functions