From: wrenashe on
OpenProcess() failed to detect if a process is running via given PID.
Does anyone have idea to do the check by win32 api?
From: Mike Collins on
At a guess, you could use CreateToolhelp32Snapshot to look for the process
depending on what information you have before hand...

Mike C

"wrenashe" <wrenashe(a)gmail.com> wrote in message
news:03c65e6e-a556-4f39-917a-854ae0d510e1(a)24g2000hsh.googlegroups.com...
> OpenProcess() failed to detect if a process is running via given PID.
> Does anyone have idea to do the check by win32 api?


From: na on

"wrenashe" <wrenashe(a)gmail.com> wrote in message
news:03c65e6e-a556-4f39-917a-854ae0d510e1(a)24g2000hsh.googlegroups.com...
> OpenProcess() failed to detect if a process is running via given PID.
> Does anyone have idea to do the check by win32 api?

Use the HKEY_PERFORMANCE_DATA section of the Registry.


From: wrenashe on
On Apr 23, 7:53 pm, "Mike Collins" <its(a)TheBottomOfThePost> wrote:
> At a guess, you could use CreateToolhelp32Snapshot to look for theprocess
> depending on what information you have before hand...
>
> Mike C
>
> "wrenashe" <wrena...(a)gmail.com> wrote in message
>
> news:03c65e6e-a556-4f39-917a-854ae0d510e1(a)24g2000hsh.googlegroups.com...
>
> > OpenProcess() failed to detect if aprocessisrunningvia given PID.
> > Does anyone have idea to do thecheckby win32 api?

Since a killed process's pid still exists in windows handle table, so
openprocess() fails to report its actual state. I used
CreateToolhelp32Snapshot() to list all known PIDs, and then check if
my pid(that killed one's) is in there. If there, process is running
otherwise, it is gone already. Now it seems work well.
From: Ben Voigt [C++ MVP] on
wrenashe wrote:
> On Apr 23, 7:53 pm, "Mike Collins" <its(a)TheBottomOfThePost> wrote:
>> At a guess, you could use CreateToolhelp32Snapshot to look for
>> theprocess depending on what information you have before hand...
>>
>> Mike C
>>
>> "wrenashe" <wrena...(a)gmail.com> wrote in message
>>
>> news:03c65e6e-a556-4f39-917a-854ae0d510e1(a)24g2000hsh.googlegroups.com...
>>
>>> OpenProcess() failed to detect if aprocessisrunningvia given PID.
>>> Does anyone have idea to do thecheckby win32 api?
>
> Since a killed process's pid still exists in windows handle table, so
> openprocess() fails to report its actual state. I used

GetExitCodeProcess?
http://msdn2.microsoft.com/en-us/library/ms683189(VS.85).aspx

> CreateToolhelp32Snapshot() to list all known PIDs, and then check if
> my pid(that killed one's) is in there. If there, process is running
> otherwise, it is gone already. Now it seems work well.