标签:style blog color window div amp
#include <TlHelp32.h>
int get_thread_amount() { int i = 0; char Buff[9]; PROCESSENTRY32 pe32; pe32.dwSize = sizeof(pe32); int processid = GetCurrentProcessId(); HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hProcessSnap == INVALID_HANDLE_VALUE) { printf("CreateToolhelp32Snapshot() failed. error code:%d.\n", GetLastError()); return 0; } BOOL bMore = ::Process32First(hProcessSnap, &pe32); HANDLE hProcess; while (bMore) { if (pe32.th32ProcessID == processid) { return pe32.cntThreads; } bMore = Process32Next(hProcessSnap, &pe32); i++; } return 0; }
windows 下获取当前进程的线程数量,布布扣,bubuko.com
标签:style blog color window div amp
原文地址:http://www.cnblogs.com/emyueguang/p/3819503.html