Registriert seit: 27. Nov 2017
2.490 Beiträge
Delphi 7 Professional
|
AW: CMD / Prozess prüfen
1. Apr 2020, 13:01
Habe in meinem "Gewusel" dashier gefunden:
Delphi-Quellcode:
function RunCmdLine(const CmdLine: string): Boolean;
var
StartupInfo: TStartupInfo;
ProcessInfo: TProcessInformation;
begin
Result := False;
FillChar(StartupInfo, SizeOf(StartupInfo), 0);
StartupInfo.cb := SizeOf(StartupInfo);
StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow := SW_SHOW;
if CreateProcess(nil, PChar(CmdLine), nil, nil,
False, NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo) then
begin
repeat
until WaitForSingleObject(ProcessInfo.hProcess, 1) = WAIT_OBJECT_0;
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);
Result := True;
end
else
MessageDLG('Cannot run command line: ' + CmdLine,mtError,[mbOk],0);
end;
Geändert von Delphi.Narium ( 1. Apr 2020 um 15:28 Uhr)
|
|
Zitat
|