请熟悉API的朋友帮我看一下(50分)

  • 主题发起人 主题发起人
  • 开始时间 开始时间

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br>&nbsp; StdCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Label1: TLabel;<br>&nbsp; &nbsp; Memo1: TMemo;<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br><br>&nbsp; private<br>&nbsp; &nbsp; &nbsp; procedure DragDropFiles(var msg:TMessage);<br>&nbsp; &nbsp; message WM_DROPFILES;<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>DragAcceptFiles(Handle,True);<br>end;<br><br>procedure TForm1.DragDropFiles(var msg: TMessage);<br>&nbsp;var<br>&nbsp; &nbsp;char1:array[0..128]of char;<br>&nbsp; &nbsp;char2:pchar ;<br>&nbsp; &nbsp;i,Sum:Integer ;<br>begin<br>&nbsp; &nbsp; sum:=DragQueryFile(msg.WParam,$FFFFFFFF,nil,0);<br>&nbsp; &nbsp; Label1.caption:='拖过来的文件有'+inttostr(Sum)+'个。';<br>&nbsp; &nbsp; char2:=@char1;<br>for i:=0 to Sum-1 do<br>begin<br>DragQueryFile(msg.WParam,i,char2,128);<br>FOrm1.Memo1.lines.add(char2);<br>end ;<br>DragFinish(msg.WParam);<br>end ;<br>end.<br><br>系统提示错示 DragFinish、DragQueryFile、DragAcceptFiles 这三个API函数没有声明<br>请问我错在那里了!!
 
Use 单元中加入ShellAPI
 
OK!!搞定,谢谢啦,分数给你了!
 
后退
顶部