Sabtu, 26 Desember 2015

Membuka Program Luar



// tambahkan Shellapi Pada Uses seperti dibawah ini ...

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,shellapi;

type
  TForm2 = class(TForm)
    Button1: TButton;
    OpenDialog1: TOpenDialog;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
OpenDialog1.Execute ;
if OpenDialog1.Files.Count > 0 then begin
ShellExecute(handle,'open',PChar(OpenDialog1.FileName), '','',SW_SHOWNORMAL);
end;
end;

end.

Tidak ada komentar:

Posting Komentar