poWaitOnExit is an option, not a must.
The process is only freead after Execute returns.
At that point the executable is already running (or it failed to do so).
Try to do some simple debugging
var
Bp: TProcess;
Err: Integer;
begin
Bp := TProcess.Create(nil);
Bp.Options := [poWaitOnExit]; //not really needed
Bp.Executable := 'C:\WGKBlck\KVS\KVDesigner.exe';
try
Bp.Execute;
except
on E: EProcess do
begin
Err := GetLastOSError;
writeln(Format('GetLastOSError = %d: "%s"',[Err,SysErrorMessage(Err)]));
end;
end;
writeln('ExitCode: ',Bp.ExitCode);
writeln('ExitStatus: ',Bp.ExitStatus);
Bp.Free;
end;
Since I don;t have this file it says:
GetLastOSError = 2: "Het systeem kan het opgegeven bestand niet vinden." //The system cannot find the given path
ExitCode: 0
ExitStatus: 0Bart