unit Unit1;
interface
uses
Winapi.Windows,
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Controls.Presentation, FMX.StdCtrls,ShellAPI,FMX.Platform.Win;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ private 宣言 }
public
{ public 宣言 }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.Button1Click(Sender: TObject);
var
LFile : string;
LParams : string;
WindowHandle: HWND;
begin
LFile := 'cmd.exe';
LParams := '';
WindowHandle := WindowHandleToPlatform(Self.Handle).Wnd;
ShellExecute(WindowHandle, 'open', PChar(LFile), PChar(LParams), nil, SW_SHOWNORMAL);
end;
end.
【参考】
◆シェル実行
http://mrxray.on.coocan.jp/Delphi/plSamples/490_CmdPrompt1.htm
◆FMXからウインドウハンドラの取得
https://ht-deko.com/techf014.html