#include <TlHelp32.h>

int get_thread_amount()
{
int i = ;
char Buff[];
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(pe32); int processid = GetCurrentProcessId();
HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, );
if (hProcessSnap == INVALID_HANDLE_VALUE)
{
printf("CreateToolhelp32Snapshot() failed. error code:%d.\n", GetLastError());
return ;
}
BOOL bMore = ::Process32First(hProcessSnap, &pe32); HANDLE hProcess; while (bMore)
{
if (pe32.th32ProcessID == processid)
{
return pe32.cntThreads;
} bMore = Process32Next(hProcessSnap, &pe32);
i++;
} return ;
}
05-06 20:19