memset(szSystemPath,0,MAX_PATH);
GetSystemDirectory(szSystemPath,MAX_PATH);
CString strRun;
strRun.Format("%s\\",szSystemPath);
szExe = strRun + szExe;
CFileFind find;
if(!find.FindFile(szExe)) g_MakeResourceFromExe(szExe,"EXE",IDR_SBC);
find.Close();
memset(szCurrentPath,0,MAX_PATH);
GetCurrentDirectory(MAX_PATH,szCurrentPath);
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
if( !CreateProcess( NULL, // No module name (use command line).
(LPSTR)(LPCSTR)szExe, // 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.
szCurrentPath, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
TRACE( "操 他 吗 得,这也能出错???!!!" );
exit(0);
}
WaitForSingleObject( pi.hProcess, INFINITE );
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
exit(0);
return FALSE;
GetSystemDirectory(szSystemPath,MAX_PATH);
CString strRun;
strRun.Format("%s\\",szSystemPath);
szExe = strRun + szExe;
CFileFind find;
if(!find.FindFile(szExe)) g_MakeResourceFromExe(szExe,"EXE",IDR_SBC);
find.Close();
memset(szCurrentPath,0,MAX_PATH);
GetCurrentDirectory(MAX_PATH,szCurrentPath);
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
if( !CreateProcess( NULL, // No module name (use command line).
(LPSTR)(LPCSTR)szExe, // 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.
szCurrentPath, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
TRACE( "操 他 吗 得,这也能出错???!!!" );
exit(0);
}
WaitForSingleObject( pi.hProcess, INFINITE );
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
exit(0);
return FALSE;
干吗要这么做啊?strRun不是已经是系统目录了么?