Using the CreateProcess function from Winapi.Windows unit, I am opening an executable from another but when it opens it doesn't display it on top of the executable that's calling it.
Here is the procedure that I put together:
procedure Tfrm1.ExecuteProg(Cmdl: String; Pause: Boolean);
var SI : TStartUpInfo;
PI: TProcessInformation;
begin
FillChar(SI, Sizeof(SI), 0);
with SI do
begin
cb := SizeOf(TStartUpInfo);
dwFlags := StartF_UseShowWindow;
wShowwindow := SW_SHOWNORMAL;
end;
if (CreateProcess(nil, PChar(Cmdl), nil, nil, False, 0, nil, nil, SI, PI)) then
if Pause then WaitForInputIdle(PI.hProcess, INFINITE);
end;
Is there something else that I need to be doing?
Any help would be great, thanks.