如何在Lazarus中为Mac执行相当于shellexecute()的操作?

Jam*_*een 7 delphi macos pascal lazarus

我怎样才能shellexecute()在Lazarus中为Mac 执行相同的操作?

小智 8

{这是代码来做到这一点.使用TProcess对象!}

uses Process;

...

procedure DoProcess;
Var
  Proc : TProcess;

Begin
  Proc := TProcess.Create(nil);
  try
    Proc.CommandLine := '/Applications/MyApp.app';

    PRoc.Options := Proc.Options + [poWaitOnExit];
    Proc.CommandLine := Proc.CommandLine + ' -someparam';
    PRoc.Execute;
  finally
    Proc.free;
  end;  
End;
Run Code Online (Sandbox Code Playgroud)