Simple CreateProcess() Explanation
Simple CreateProcess() Explanation
如何使用CreateProcess()来启动程序?我认为一个很好的例子是像这样的注释代码。
int function() {
dox(int a, char b); //This does this and you should use it for this
doz(bool c); //You should use this for this
if (thisstatus == thatthing) { //The variable thisthing should contain that
doy(variable); //This does this and this
}
好,看看MSDN中的CreateProcess()
样本
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line)
argv[1], // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi ) // Pointer to PROCESS_INFORMATION structure
)
{
printf( "CreateProcess failed (%d).n", GetLastError() );
return;
}
我认为在示例上下文的注释中已经记录得足够好了。
你可能想在你的问题中详细说明哪些评论对你来说是不理解的,这样我可以试着解释更多(但总的来说,我是用样本来解释的)。