==> 在 celica.bbs@bbs.et.ntust.edu.tw (Celica) 的文章中提到:
> 請問Visual C++中有沒有API
> 可以Load其它Exe檔並傳回該Process的Process ID.
> _exec()好像Load成功後不會Return回Calling Retine.
> system()好像只傳回non zero value.
用CreateProcess,
她會傳回一個Process information 的structure,
內含Process id
BOOL CreateProcess(
LPCTSTR lpApplicationName, // pointer to name of executable module
LPTSTR lpCommandLine, // pointer to command line string
LPSECURITY_ATTRIBUTES lpProcessAttributes, // pointer to process security attributes
LPSECURITY_ATTRIBUTES lpThreadAttributes, // pointer to thread security attributes
BOOL bInheritHandles, // handle inheritance flag
DWORD dwCreationFlags, // creation flags
LPVOID lpEnvironment, // pointer to new environment block
LPCTSTR lpCurrentDirectory, // pointer to current directory name
LPSTARTUPINFO lpStartupInfo, // pointer to STARTUPINFO
LPPROCESS_INFORMATION lpProcessInformation // pointer to PROCESS_INFORMATION
); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--
* Origin: ★ 交通大學資訊科學系 BBS ★ <bbs.cis.nctu.edu.tw: 140.113.23.3>