简体   繁体   中英

How Do I Run an .exe From My Program and Obtain a Handle

How do I open a process and obtain a handle too it in C++. I know that there is system() and numerous methods to obtain a handle, but I'm sure there is a neater/alternative way to doing this. Or is system() the only way to open a .exe from inside your own?

A common way to do this is to use the Win32 API CreateProcess . The last parameter of this function is an out parameter to a structure ( PROCESS_INFORMATION ) containing the handle to the process ( HANDLE hProcess ).

使用ShellExecute

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM