uses shellapi;
PROCEDURE FinishDropped(VARMsg:TMessage);
MessageWM_DropFiles;
procedure TForm1.FormCreate(Sender:TObject);
begin
DragAcceptFiles(Handle,True);
end;
Procedure TForm1.FinishDropped(VARMsg:TMessage);
Var
hDrop:THandle;
iFile:Uint;
lpszFile
char;
CountOfFiles:integer;
FileIndex:integer;
ReSults:string;
begin
hDrop:=Msg.WParam;
getmem(pchar,255);
iFile:=$FFFFFFFF;
CountOfFiles:=DragQueryFile(hDrop,iFile,lpszFile,254);
ReSults:='';
for FileIndex:=0 to CountOfFiles-1 do
begin
iFile:=FileIndex;
DragQueryFile(hDrop,iFile,lpszFile,254);
ReSults:=ReSults+#13#10+lpszFile;
end;
Dispose(lpszFile);
memo1.Clear;
memo1.lines.add('拖放了'+IntToStr(CountOfFiles) + '个文件:'+ReSults);
DragFinish(hDrop);
end;
end.