利用Windows的消息 看一下我的代码
procedure Tdragfrm.wmdropfiles(var message: TMessage);
var
p
char ;
i : word ;
Num : Word ;
tmplist : TStringList ;
begin
inherited;
p := SysGetMem(255);
Num := DragQueryFile(Message.WParam,$ffffffff,nil,0);
if Num = 1 Then
begin
DragQueryFile(Message.WParam,0,p,255);
try
OneFileFrm := TOneFileFrm.Create(self);
OneFileFrm.edtFile.Text := String(p);
OneFileFrm.ShowModal ;
Finally
OneFileFrm.Free ;
sysFreeMem(p);
end;
end
else begin
tmplist := TStringList.Create ;
for i := 0 to Num - 1 do
begin
DragQueryFile(Message.WParam,i,p,255);
tmplist.Add(String(p));
end;
try
FilesFrm := TFilesFrm.Create(self);
FilesFrm.FileAddToList(tmplist);
FilesFrm.ShowModal ;
Finally
FilesFrm.Free ;
sysFreeMem(p);
end;
end;
end;