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.
Kamis, 25 Oktober 2012
Memanggil Exe, File, alamat Website dari Borland Delphi dengan Perintah ShellExecute
Label:
Tutorial delphi
Langganan:
Posting Komentar (Atom)
10 komentar:
jika file .exe nya di D:\ code pemanggilnya bagaimana pak ??
To : Anonim
Untuk Local disk D:\ atau E:\ kita memakai pchar
contoh :
Saya Punya Data di Local E:\ dengan nama "Project1 "
lalu untuk script nya tinngal masukkin di button
========================================
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
shellExecute(hinstance,pchar('open'),
pchar('E:\Gallery\Gallery Programing\Kumpulan program\Project1.exe'), nil, nil,
SW_ShowNormal);
end;
========================================
>>>E:\Gallery\Gallery Programing\Kumpulan program\Project1.exe <<< bisa di ganti apa aja berdasarkan alamat address di windows explorer anda
contoh : D:\project.exe atau D:\data\project1.exe
Bisa juga dengan file lain : D:\data\DATABASE.mdb atau D:\data\Readme.txt dan lain-lain
oke sekian selamat mencoba semoga berhasil
klo yang kita panggil extentensi nya selain exe bisa mas
misal kita memanggil catatan.txt
@Moh Rifai
bisa...
kalau cara pemanggilan exe di mobile bisa ga mas..??
misal di andorid, kita paggil google bisa gak mas..??
seandainya bisa gimana caranya mas ya...???
Bro, ane mau tanya ni.. Ane lagi pusing ni, mkiirin cara inputin file dari inputan dbedit terus keluarannya jadi link yang bisa dibuka dalam bentuk file word atau text. Gmn caranya ya?
makasih gan infonya
makasih bro infonya, sangat bermanfaat.
sangat sangat mantap sekali mas bro...
maaf gan..misal file yang kita panggil berupa perintah bat kemu dia kita ingin menampika log perintah ke dalam mmo gmn y?
Posting Komentar
Untuk Mengurangi SPAM .Gunakan Kata-kata yang sewajarnya, sopan dalam tutur kata berbahasa. Sekian Terima kasih.