procedure Tform1.WMDROPFILES(var msg: TWMDropFiles);
const
MAXFILENAME = 255;
var
cnt, fileCount : integer;
fileName : array [0..MAXFILENAME] of char;
begin
fileCount := DragQueryFile(msg.Drop, $FFFFFFFF, fileName, MAXFILENAME) ;
for cnt := 0 to -1 + fileCount do
begin
DragQueryFile(msg.Drop, cnt, fileName, MAXFILENAME) ;
memo1.Lines.Insert(0, fileName) ;
end;
DragFinish(msg.Drop) ;
end;