Registriert seit: 18. Aug 2004
Ort: Edewecht
712 Beiträge
Delphi 5 Professional
|
Re: mit createProcess ein Prog starten ohne Focus zu verlier
15. Feb 2005, 11:24
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
SI: TStartupInfo;
PI: TProcessInformation;
begin
FillChar(SI, SizeOf(TStartupInfo), 0);
with SI do
begin
cb := SizeOf(TStartupInfo);
dwFlags := STARTF_USESHOWWINDOW;
wShowWindow := SW_SHOWNOACTIVATE;
end;
if CreateProcess(nil, 'NOTEPAD.EXE', nil, nil, False, 0, nil, nil, SI, PI) then
begin
WaitForInputIdle(PI.hProcess, INFINITE);
BringWindowToTop(Self.Handle);
CloseHandle(PI.hProcess);
CloseHandle(PI.hThread);
end;
end;
Ciao, Sprint.
"I don't know what I am doing, but I am sure I am having fun!"
|
|
Zitat
|