wathavy
June 22nd, 2008, 08:40 AM
Hi, I have a following code worked fine with XP or W2K.
The Alibre.exe was launched.
But this does not apply with Vista, any other API available with Vista?
Thank you.
//if( !CreateProcess( L"C:\\Program Files\\Alibre Design\\alibre.exe", // No module name (use command line)
if( !CreateProcess( lpPath, // No module name (use command line)
NULL, // 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
)
{
return;
}
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, 2000 );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
hr = GetActiveObject (clsid, NULL, &pUnk);
while(FAILED (hr) ){
Sleep(2000);
hr = GetActiveObject (clsid, NULL, &pUnk);
}
}
The Alibre.exe was launched.
But this does not apply with Vista, any other API available with Vista?
Thank you.
//if( !CreateProcess( L"C:\\Program Files\\Alibre Design\\alibre.exe", // No module name (use command line)
if( !CreateProcess( lpPath, // No module name (use command line)
NULL, // 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
)
{
return;
}
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, 2000 );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
hr = GetActiveObject (clsid, NULL, &pUnk);
while(FAILED (hr) ){
Sleep(2000);
hr = GetActiveObject (clsid, NULL, &pUnk);
}
}