N
netbug
Unregistered / Unconfirmed
GUEST, unregistred user!
请看(这是个书上的例子):<br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> ListBox1: TListBox;<br> procedure Button1Click(Sender: TObject);<br> end;<br>type<br> Enumwindowsproc=function (Hwnd:THandle;paramointer):boolean;stdcall;<br> function gettitle(hwnd:THandle;paramointer):boolean;stdcall;<br><br>var<br> Form1: TForm1;<br>implementation<br>{$R *.DFM}<br>function gettitle(hwnd:THandle;paramointer):boolean;stdcall;<br> var text:string;<br>begin<br> setlength(text,100);<br> getwindowtext(hwnd,pchar(text),100);<br> form1.ListBox1.Items.Add(inttostr(hwnd)+':'+text);<br> result:=true;<br>end;<br>procedure TForm1.Button1Click(Sender: TObject);<br> var ewproc:enumwindowsproc;<br>begin<br> listbox1.Items.Clear;<br> ewproc:=gettitle;<br> enumwindows(@ewproc,0);<br>end;<br>我想问:<br>一:enumwindows(@ewproc,0)函数中的第二个参数是代表什么?为何可以为0?<br>二: getwindowtext(hwnd,pchar(text),100)函数中的第一个参数句柄此时<br>还未赋值,为什么可以调用?谢谢。