unit dropFormUnit; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TDropForm = class(TForm) Memo1: TMemo; procedure FormCreate(Sender: TObject) ; private procedure WMDROPFILES(var msg : TWMDropFiles) ; message WM_DROPFILES; public { Public declarations } end; var DropForm: TDropForm; implementation {$R *.dfm} uses ShellApi; //form's OnCreate event handler procedure TDropForm.FormCreate(Sender: TObject) ; begin //form is ready to accept files DragAcceptFiles( Handle, True ) ; end; (* handle files being dropped on a form *) procedure TDropForm.WMDROPFILES(var msg: TWMDropFiles) ; const MAXFILENAME = 255; var cnt, fileCount : integer; fileName : array [0..MAXFILENAME] of char; begin // how many files dropped? fileCount := DragQueryFile(msg.Drop, $FFFFFFFF, fileName, MAXFILENAME) ; // query for file names for cnt := 0 to -1 + fileCount do begin DragQueryFile(msg.Drop, cnt, fileName, MAXFILENAME) ; //do something with the file(s) memo1.Lines.Insert(0, fileName) ; end; //release memory DragFinish(msg.Drop) ; end; end.