![]() |
FPC/Lazarus - Ähnliches wie RunAndWaitShell für Linux
In Delphi benutze ich diese Funktion um einen Prozess zu starten ohne die Hauptform einzufrieren:
Code:
Mit folgendem Kommando kann ich dies leider nicht in Linux mit FPC/Lazarus erreichen:
procedure RunAndWaitShell(Executable, Parameter: STRING; ShowParameter: INTEGER);
var Info: TShellExecuteInfo; pInfo: PShellExecuteInfo; exitCode: DWord; begin {Pointer to Info} pInfo := @Info; {Fill info} with Info do begin cbSize := SizeOf(Info); fMask := SEE_MASK_NOCLOSEPROCESS; wnd := application.Handle; lpVerb := NIL; lpFile := PChar(Executable); {Parametros al ejecutable} {Executable parameters} lpParameters := PChar(Parameter + #0); lpDirectory := NIL; nShow := ShowParameter; hInstApp := 0; end; {Execute} ShellExecuteEx(pInfo); {Wait to finish} repeat exitCode := WaitForSingleObject(Info.hProcess, 500); Application.ProcessMessages; until (exitCode <> WAIT_TIMEOUT); end;
Code:
Kennt Einer von Euch eine Möglichkeit das Gleiche unter Linux hinzubekommen?
procedure TForm1.Button1Click(Sender: TObject);
var AProcess1: TProcess; begin AProcess1 := TProcess.Create(nil); AProcess1.CommandLine := 'gparted'; AProcess1.Options := AProcess1.Options + [poWaitOnExit]; AProcess1.Execute; AProcess1.Free; ShowMessage ('gparted ended'); end; Ein FPC/Lazarus hatte gemeint mit einem neuen Thread, weis aber leider noch nicht wie? |
Re: FPC/Lazarus - Ähnliches wie RunAndWaitShell für Linux
Falls es noch aktuell ist, vielleicht hilft dir das:
![]() |
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:11 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz