Drag Files Ke Form
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls, ExtCtrls, jpeg,
OleCtrls, SHDocVw;
type
TForm1 = class(TForm)
Image1: TImage;
ListBox1: TListBox;
WebBrowser1: TWebBrowser;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
// mendeklarasikan procedure acceptfiles
procedure AcceptFiles(var msg: TMessage);
message WM_DROPFILES;
end;
var
Form1: TForm1;
implementation
uses
// menginclude shellapi ke program
ShellAPI;
{$R *.DFM}
procedure TForm1.AcceptFiles(var msg: TMessage);
const
cnMaxFileNameLen = 255;
var
i,
nCount: integer;
acFileName: array[0..cnMaxFileNameLen] of char;
begin
// menghitung jumlah file yang di drag
nCount := DragQueryFile(msg.WParam,
$FFFFFFFF,
acFileName,
cnMaxFileNameLen);
// pengulangan jumlah file yang di blok
for i := 0 to nCount - 1 do
begin
DragQueryFile(msg.WParam, i,
acFileName, cnMaxFileNameLen);
// memasukan alamat file yang didrag ke listbox
ListBox1.Items.Add(acFileName);
end;
//jika ingin menampilkan gambar gunakan
//image1.Picture.LoadFromFile(acFileName);
//jika ingin menampilkan web gunakan
//WebBrowser1.Navigate(acFileName);
DragFinish(msg.WParam);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
// mengijinkan file untuk di drag di form
DragAcceptFiles(Handle, True);
end;
end.
// sintak ini masih bisa kita kembangkan untuk membuka file bertipe lain serti Txt Dan Lain Sebagainya
Random Articles
- Bikin Rekaman Suara Sendiri Dengan Delphi
- PascalClass #1: Analisa Database dan Machine Learning
- Referensi Pemrograman Bahasa Pascal dari Tim Pembina TOKI
- Powtils
- Mengunci Regedit, MSCONFIG, TaskMngr, dll
- Simulasi Infeksi Virus 1.0 - OpenSource
- DisabledTaskManger Dgn Delphi
- Membuat tabel di excel dengan menggunakan editor SQL
- Deteksi VMWare
- Cek apakah program sudah berjalan?
AI Forward

🚀 We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now:
https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD
Last Articles
Recent Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 4 years ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 5 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 12 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 12 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 12 years ago