Get a list of processes running in Win32

Started by
3 comments, last by jimywang 19 years ago
How can I get a list of processes running in Win32 api?
Advertisement
Try to google on "win32 process enumeration" for example...
PM Times change...Excuse my poor english!
create a snapshot with: CreateToolhelp32Snapshot()

and then use Process32First and Process32Next to enumerate the processes
some of my old code

HANDLE snapshot = (TH32CS_SNAPPROCESS , 0);
if(snapshot == INVALID_HANDLE_VALUE) return false;

// enumerate the snapshot
PROCESSENTRY32 processEntry;
if(Process32First(snapshot, &processEntry) == FALSE)
{
return false;
}
processesRunning.push_back(processEntry);
while(Process32Next(snapshot, &processEntry) != FALSE)
{
processesRunning.push_back(processEntry);
}

// close the snapshot
CloseHandle(snapshot);
thx,problem solved.

This topic is closed to new replies.

Advertisement