agree面条
unit Unit1;
interface
uses
Windows, Messages, SysUtils,shellapi, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure WMDrops( var message:tmessage);message WM_DROPFILES;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
Dragacceptfiles(form1.handle,true);
end;
procedure TForm1.WMDrops(var message:tmessage);
var
p:array[0..254] of char;
i:word;
begin
inherited;
form1.Memo1.Clear;
{$IFDEF WIN32}
i:=DragQueryFile(Message.wParam,$ffffffff,nil,0);
{$ELSE}
i:=DragQueryFile(Message.wParam,$ffff,nil,0);
{$ENDIF}
caption:=inttostr(i);
for i:=0 to i-1 do
begin
DragQueryFile(Message.wParam,i,p,255);
form1.Memo1.Lines.Add(strpas(p));
end;
end;
end.