Hallo zusammen,
nachdem ich unter dem C++ Builder V5, update Pack 1 mit CreateProcess einen Process starte frage ich mit WaitForSingleObject ab ob der Process gestartet wurde. Nach Ablauf der Wartezeit bekomme ich die Exception: "Klasse nicht vorhanden!" Die selbe Exception erhalte ich bei WaitForInputIdle. Was mache falsch?
Danke
Dieter
void __fastcall TStartAppForm::OeffneAppButtonClick(TObject *Sender)
{
String FullPath = "C:\\WINNT\\system32\\Notepad.exe";
StartInfo.cb = sizeof(TStartupInfo);
setmem(&StartInfo, sizeof(TStartupInfo), 0);
if(CreateProcess(NULL, // Applikation-Name, bei 16Bit Anwendungen NULL
FullPath.c_str() , // Command-Line, Applikationsname
NULL, // Process-Attributes
NULL, // Thread-Attributes
false, // Creation-Handle
CREATE_DEFAULT_ERROR_MODE | NORMAL_PRIORITY_CLASS, // Creation-Flags
NULL, // Enviroment
NULL, // Current Directory
&StartInfo, // Startup Info
&ProzessInfo // Process Information
)==TRUE)
{
// if(WaitForInputIdle(ProzessInfo.hProcess, 5000) == WAIT_TIMEOUT)
if(WaitForSingleObject(ProzessInfo.hProcess, 5000) == WAIT_TIMEOUT)
AnzeigeException("[TStartAppForm::OeffneAppButtonClick] WaitForSingleObject");
// Speicher wieder freigeben
CloseHandle(ProzessInfo.hThread);
// Speicher wieder freigeben
CloseHandle(ProzessInfo.hProcess);
}
else
{
AnzeigeException("[TStartAppForm::OeffneAppButtonClick] CreateProcess");
}
}
nachdem ich unter dem C++ Builder V5, update Pack 1 mit CreateProcess einen Process starte frage ich mit WaitForSingleObject ab ob der Process gestartet wurde. Nach Ablauf der Wartezeit bekomme ich die Exception: "Klasse nicht vorhanden!" Die selbe Exception erhalte ich bei WaitForInputIdle. Was mache falsch?
Danke
Dieter
void __fastcall TStartAppForm::OeffneAppButtonClick(TObject *Sender)
{
String FullPath = "C:\\WINNT\\system32\\Notepad.exe";
StartInfo.cb = sizeof(TStartupInfo);
setmem(&StartInfo, sizeof(TStartupInfo), 0);
if(CreateProcess(NULL, // Applikation-Name, bei 16Bit Anwendungen NULL
FullPath.c_str() , // Command-Line, Applikationsname
NULL, // Process-Attributes
NULL, // Thread-Attributes
false, // Creation-Handle
CREATE_DEFAULT_ERROR_MODE | NORMAL_PRIORITY_CLASS, // Creation-Flags
NULL, // Enviroment
NULL, // Current Directory
&StartInfo, // Startup Info
&ProzessInfo // Process Information
)==TRUE)
{
// if(WaitForInputIdle(ProzessInfo.hProcess, 5000) == WAIT_TIMEOUT)
if(WaitForSingleObject(ProzessInfo.hProcess, 5000) == WAIT_TIMEOUT)
AnzeigeException("[TStartAppForm::OeffneAppButtonClick] WaitForSingleObject");
// Speicher wieder freigeben
CloseHandle(ProzessInfo.hThread);
// Speicher wieder freigeben
CloseHandle(ProzessInfo.hProcess);
}
else
{
AnzeigeException("[TStartAppForm::OeffneAppButtonClick] CreateProcess");
}
}
Comment