Re: Quesion on mutex
<sabarad_arun@hotmail.com> wrote in message
news:1152774572.474517.322040@s13g2000cwa.googlegroups.com...
Hi David,
i was able to do it..I used the toolhelp API's to do this..The code is
as follows.
HANDLE hSnapShot;
hSnapShot=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS ,0);
PROCESSENTRY32* processInfo=new PROCESSENTRY32;
processInfo->dwSize=sizeof(PROCESSENTRY32);
while(Process32Next(hSnapShot,processInfo)!=FALSE)
{
cout<<endl<<"Name: "<<processInfo->szExeFile;
}
CloseHandle(hSnapShot);
delete processInfo;
From this i get the list of all the processes running in the system..
Glad you found a solution, Arun! BTW, I've found that on Win2K,
processInfo->szExeFile is truncated to some number of characters (11 or 16,
I think). It's not truncated on Win9x or WinXP. So if the process has a
longer filename than that, it will be truncated. To get the full filename,
I believe I iterated the modules of the process, and the first module
retrieved will be the .exe (with the full name).
Even Process Explorer (sysinternals.com) has this problem. On Win2K, it
shows a truncated process name. I've e-mailed Mark Russinovich, but so far
he hasn't fixed it.
-- David