A
aynes
Unregistered / Unconfirmed
GUEST, unregistred user!
delphi 7+windows xp<br>原代码:<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> ListBox1: TListBox;<br> function EnumerateChildWindows(hWnd:HWND; lParam:LPARAM): BOOL; stdcall;<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>{ TForm1 }<br><br>function TForm1.EnumerateChildWindows(hWnd: HWND; lParam: LPARAM): BOOL;<br>var<br> ClassName: Array[0..255] of char; // this holds the class name of our child windows<br>begin<br> {get the class name of the given child window}<br> GetClassName(hWnd,ClassName,255);<br><br> {display it in the list box}<br> Form1.ListBox1.Items.Add(ClassName);<br><br> {continue enumeration}<br> Result:=TRUE;<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> ListBox1.Items.Clear;<br><br> {enumerate all child windows belonging to Form1}<br> EnumChildWindows(Form1.Handle,@EnumerateChildWindows,0);<br>end;<br><br>end.<br><br>出错信息:[Error] Unit1.pas(49): Variable required<br><br>是什么原因,如何改正。