1个回答
展开全部
#include <tlhelp32.h>
int GetProcessThreadList(DWORD th32ProcessID) //进程的ID
{
HANDLE hThreadSnap;
THREADENTRY32 th32;
hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, th32ProcessID);
if (hThreadSnap == INVALID_HANDLE_VALUE)
{
return 1;
}
th32.dwSize = sizeof(THREADENTRY32);
if (!Thread32First(hThreadSnap, &th32))
{
CloseHandle(hThreadSnap);
return 1;
}
do
{
if (th32.th32OwnerProcessID == th32ProcessID)
{
printf("ThreadID: %ld\n", th32.th32ThreadID); //显示找到的线程的ID
}
}while(Thread32Next(hThreadSnap, &th32));
CloseHandle(hThreadSnap);
return 0;
}
int GetProcessThreadList(DWORD th32ProcessID) //进程的ID
{
HANDLE hThreadSnap;
THREADENTRY32 th32;
hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, th32ProcessID);
if (hThreadSnap == INVALID_HANDLE_VALUE)
{
return 1;
}
th32.dwSize = sizeof(THREADENTRY32);
if (!Thread32First(hThreadSnap, &th32))
{
CloseHandle(hThreadSnap);
return 1;
}
do
{
if (th32.th32OwnerProcessID == th32ProcessID)
{
printf("ThreadID: %ld\n", th32.th32ThreadID); //显示找到的线程的ID
}
}while(Thread32Next(hThreadSnap, &th32));
CloseHandle(hThreadSnap);
return 0;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询