c++ - how to wait for a non-child process with winapi? -
i read:
code snippet:
handle hprocess = openprocess(synchronize, true, inprocessid); if (null == hprocess) { waitforsingleobject(hprocess,infinite); }
i've tried waitforsingleobject
, waitforsingleobjectex
, neither waiting.
for example assume notepad running , want wait closed user. shall ?
from documentation openprocess
:
if function succeeds, return value open handle specified process.
if function fails, return value null. extended error information, call getlasterror.
so if statement should be:
if (null != hprocess) ...
Comments
Post a Comment