Memanggil Exe, File, alamat Website dari Borland Delphi dengan Perintah ShellExecute

Tutorial Delphi kali ini Membahas tentang Cara memanggil Exe, File, alamat Website, Pemutar Music, Office dll dari Borland Delphi dengan Perintah ShellExecute. ShellExecute merupakan salah satu fungsi API yang memiliki kegunaan yang beragam. sekarang saya bahas dalam pemrogramannya dengan pemanggilan Web Mozila firefox ,Alamat Website dll. Tambahkan ShellAPI pada Uses







Source Lengkap :



unit Unit1;
//==========================================================//
//copyright : http://olvandra.blogspot.com                  //
//            http://meanddelphi.blogspot.com                //
//==========================================================//


interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Buttons, StdCtrls, ExtCtrls, jpeg, Shellapi;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    SpeedButton1: TSpeedButton;
    Image1: TImage;
    Label2: TLabel;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    SpeedButton4: TSpeedButton;
    SpeedButton5: TSpeedButton;
    SpeedButton6: TSpeedButton;
    SpeedButton7: TSpeedButton;
    SpeedButton8: TSpeedButton;
    procedure SpeedButton1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure SpeedButton2MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure SpeedButton3MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure SpeedButton8MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure SpeedButton4MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure SpeedButton5MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure SpeedButton6MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure SpeedButton7MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure SpeedButton2Click(Sender: TObject);
    procedure Label1MouseEnter(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure SpeedButton8Click(Sender: TObject);
    procedure SpeedButton4Click(Sender: TObject);
    procedure SpeedButton6Click(Sender: TObject);
    procedure SpeedButton5Click(Sender: TObject);
    procedure SpeedButton7Click(Sender: TObject);
    procedure Label1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.SpeedButton1MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin

label2.Caption:='Mozila FireFox';
end;

procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin

label2.Caption:='';
label1.Font.Color:=clLime;
end;

procedure TForm1.SpeedButton2MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin

Label2.Caption:='Internet Explorer';
end;

procedure TForm1.SpeedButton3MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin

label2.Caption:='Media Player';
end;

procedure TForm1.SpeedButton8MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin

label2.Caption:='Kalkulator';
end;

procedure TForm1.SpeedButton4MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin

label2.Caption:='Ms.Word 2007';
end;

procedure TForm1.SpeedButton5MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin

label2.Caption:='Ms.Excel 2007';
end;

procedure TForm1.SpeedButton6MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin

label2.Caption:='Ms.Power Point 2007';
end;

procedure TForm1.SpeedButton7MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin

label2.Caption:='Ms.Access 2007';
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin

ShellExecute(Application.handle, 'open', 'iexplore.exe', nil, nil,
SW_ShowNormal);

end;

procedure TForm1.Label1MouseEnter(Sender: TObject);
begin

label1.Font.Color:=clBlue;
label2.Caption:='olvandra.blogspot.com';
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin

ShellExecute(Application.handle, 'open', 'firefox.exe', nil, nil,
SW_ShowNormal);

end;

procedure TForm1.SpeedButton3Click(Sender: TObject);

begin

ShellExecute(Application.handle, 'open', 'wmplayer.exe', nil, nil,
SW_ShowNormal);

end;

procedure TForm1.SpeedButton8Click(Sender: TObject);
begin

ShellExecute(Application.handle, 'open', 'calc.exe', nil, nil,
SW_ShowNormal);
end;

procedure TForm1.SpeedButton4Click(Sender: TObject);
begin

ShellExecute(Application.handle, 'open', 'Winword.exe', nil, nil,
SW_ShowNormal);
end;

procedure TForm1.SpeedButton6Click(Sender: TObject);
begin

ShellExecute(Application.handle, 'open', 'POWERPNT.exe', nil, nil,
SW_ShowNormal);
end;

procedure TForm1.SpeedButton5Click(Sender: TObject);
begin

ShellExecute(Application.handle, 'open', 'excel.exe', nil, nil,
SW_ShowNormal);
end;

procedure TForm1.SpeedButton7Click(Sender: TObject);
begin

ShellExecute(Application.handle, 'open', 'ACCICONS.exe', nil, nil,
SW_ShowNormal);

end;

procedure TForm1.Label1Click(Sender: TObject);
begin

ShellExecute(Application.handle, 'open', 'http://olvandra.blogspot.com', nil, nil,
SW_ShowNormal);
end;
//==========================================================//
//copyright : http://olvandra.blogspot.com                  //
//            http://meanddelphi.blogspot.com               //
//==========================================================//
end.

One thought on “Memanggil Exe, File, alamat Website dari Borland Delphi dengan Perintah ShellExecute

Silahkan Tulis Komentar Anda, Sopan dan Berwibawa