以下方法你可以参考:
1.在Private部分声明:
procedure FileIsDropped(var Msg: TMessage); message WM_DropFiles; //消息处理
实现部分
2.在Tform1.create中写一句
DragAcceptFiles(Handle, True);
3.
procedure TForm1.FileIsDropped(var Msg: TMessage);
var
hDrop: THandle;
fName: array[0..254] of CHAR;
NumberOfFiles: INTEGER;
fCounter: INTEGER;
Names: TStringlist;
begin
Names := TStringlist.create;
hDrop := Msg.WParam;
NumberOfFiles := DragQueryFile(hDrop, $FFFFFFFF, fName, 254);
for fCounter := 1 to NumberOfFiles do
begin
DragQueryFile(hDrop, fCounter - 1, fName, 254);
Names.Add(fName);
end;
DragFinish(hDrop);
//Names中存储了所有拖放来的文件名,再找一个装入你的RichEdit中吧.