BOOL OpenPrecess()
{
STARTUPINFO si;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
PROCESS_INFORMATION ProcessInfo;
ZeroMemory( &ProcessInfo, sizeof(ProcessInfo) );
// Start the child process.
if ( !CreateProcess("文件路径", // No module name (use command line)
"命令行参数", // 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
&ProcessInfo) // Pointer to PROCESS_INFORMATION structure
)
{
return FALSE;
}
CloseHandle( ProcessInfo.hProcess );
ProcessInfo.hProcess = NULL;
CloseHandle( ProcessInfo.hThread );
ProcessInfo.hThread = NULL;
return TRUE;
}
{
STARTUPINFO si;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
PROCESS_INFORMATION ProcessInfo;
ZeroMemory( &ProcessInfo, sizeof(ProcessInfo) );
// Start the child process.
if ( !CreateProcess("文件路径", // No module name (use command line)
"命令行参数", // 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
&ProcessInfo) // Pointer to PROCESS_INFORMATION structure
)
{
return FALSE;
}
CloseHandle( ProcessInfo.hProcess );
ProcessInfo.hProcess = NULL;
CloseHandle( ProcessInfo.hThread );
ProcessInfo.hThread = NULL;
return TRUE;
}