Recent

Author Topic: ShowModal external program  (Read 1790 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
ShowModal external program
« on: September 15, 2017, 06:57:20 pm »
Hi guys, does anyone tell me how to launch an external executable, which behaves like a modal form?
To explain better I have a program A and a program B (both use forms) but when I launch program B from program A I would like the B form look modal compared to A.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

ASerge

  • Hero Member
  • *****
  • Posts: 2223
Re: ShowModal external program
« Reply #1 on: September 15, 2017, 07:33:06 pm »
Modal is a property for a secondary window in one application. What do you mean?

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: ShowModal external program
« Reply #2 on: September 15, 2017, 07:35:39 pm »
I mean that until I close the external program I can no longer interact with the main program.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

ASerge

  • Hero Member
  • *****
  • Posts: 2223
Re: ShowModal external program
« Reply #3 on: September 15, 2017, 08:02:01 pm »
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   ExtProc: TProcess;
  4. begin
  5.   ExtProc := TProcess.Create(nil);
  6.   try
  7.     ExtProc.Executable := 'calc.exe';
  8.     ExtProc.Options := [poWaitOnExit];
  9.     ExtProc.Execute;
  10.   finally
  11.     ExtProc.Free;
  12.   end;
  13. end;

 

TinyPortal © 2005-2018