N
netbug
Unregistered / Unconfirmed
GUEST, unregistred user!
请看:<br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> ListBox1: TListBox;<br> Edit1: TEdit;<br> procedure Button1Click(Sender: TObject);<br> end;<br><br>enumwindowsproc=function (hnd:THandle;paramointer):boolean;stdcall;<br>function gettitle(hnd:THandle;paramointer):boolean;stdcall;<br>var<br> Form1: TForm1;<br><br> function gettitle(hnd:THandle;paramointer):boolean;stdcall;<br> var textchar;<br> begin<br> getmem(text,255);<br> sendmessage(hnd,wm_gettext,255,integer(text));<br> form1.ListBox1.Items.Add(inttostr(hnd)+':'+strpas(text));<br> result:=true;<br> end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var i:integer;ewproc:enumwindowsproc;<br>begin<br>listbox1.Items.Clear;<br>ewproc:=gettitle;<br>i:=findwindow(nil,'Form2');<br>form1.ListBox1.Items.Add(inttostr(i)+'form2');<br>enumchildwindows(i,@ewproc,0);<br>end;<br>我想问:<br>一:什么是回调函数?它的参数是如何传递的?它的运行过程如何?<br>二:在本例中,在enumchildwindows(i,@ewproc,0)中的参数@ewproc<br>是个函数,而enumchildwindows(i,@ewproc,0)调用函数gettitle时,<br>函数gettitle中的参数hnd还是未知的,并据说它的参数hnd是由<br>enumchildwindows这个API提供的,我想问:在这里到底是谁调用谁?<br>谢谢。