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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -