Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   FPC/Lazarus - Ähnliches wie RunAndWaitShell für Linux (https://www.delphipraxis.net/88244-fpc-lazarus-aehnliches-wie-runandwaitshell-fuer-linux.html)

Amnon82 12. Mär 2007 15:32


FPC/Lazarus - Ähnliches wie RunAndWaitShell für Linux
 
In Delphi benutze ich diese Funktion um einen Prozess zu starten ohne die Hauptform einzufrieren:

Code:
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;
Mit folgendem Kommando kann ich dies leider nicht in Linux mit FPC/Lazarus erreichen:

Code:
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;
Kennt Einer von Euch eine Möglichkeit das Gleiche unter Linux hinzubekommen?
Ein FPC/Lazarus hatte gemeint mit einem neuen Thread, weis aber leider noch nicht wie?

monta 16. Mär 2007 22:55

Re: FPC/Lazarus - Ähnliches wie RunAndWaitShell für Linux
 
Falls es noch aktuell ist, vielleicht hilft dir das:

http://wiki.lazarus.freepascal.org/E...al_Programs/de


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