look,从电脑报上抄过来的
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
shellapi, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure WMDropFiles(var message:TMessage);message WM_DROPFILES;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure tform1.WMDropFiles(var message:TMessage);
var
p:array[0..254] of char;
i:word;
begin
inherited;
memo1.lines.clear;
i:=dragqueryfile(message.wparam,$ffffffff,nil,0);
//i:=dragqueryfile(message.wparam,$ffff,nil,0);
caption :=inttostr(i);
for i:=0 to i-1 do
begin
dragqueryfile(message.wparam,i,p,255);
memo1.lines.Add(strpas(p));
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
dragacceptfiles(form1.handle,true);
end;
end.