Process ID from name

Started by
3 comments, last by n0ob 20 years, 9 months ago
Is there a way to retrieve a process ID from the process name? Thanks! Kings of Chaos
Advertisement
EnumProcesses!!! Am I on the right track?!??

Kings of Chaos
NO!! It''s CreateToolhelp32Snapshot and stuff!!!! right??!

Kings of Chaos
ALLRIGHT!!! Here''s what I''m doing:

HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
PROCESSENTRY32 proc ;
proc.dwSize = sizeof(proc);
long f = Process32First(hSnap,&proc);

char sname[MAX_PATH]={0};
while(f)
{
strcpy(sname,proc.szExeFile);
cout << sname << endl << flush;
f = Process32Next(hSnap, &proc);
}

As a test. This works!! WOOHOO!! Now all I have to do is get the ID! Thanks!

Kings of Chaos
Errr... no problem, anytime! V^_^V

This topic is closed to new replies.

Advertisement