如何根据一个窗体的句柄,得到本窗体内有那些控件?(10分)

A

abencat

Unregistered / Unconfirmed
GUEST, unregistred user!
如何根据一个窗体的句柄,得到本窗体内有那些控件?
 
function Proc(AWnd: HWND; AlParam: LPARAM):Boolean;stdcall;<br>var<br>&nbsp; WndCaption: array[0..254] of Char;<br>&nbsp; ulpClassName : array[0..254] of Char;<br>&nbsp; i : integer ;<br>begin<br>&nbsp; GetWindowText(AWnd, WndCaption, 254);<br>&nbsp; GetClassName(AWnd, ulpClassName, 254);<br>&nbsp; if (WndCaption[0]&lt;&gt;chr(0)) and IsWindowVisible(AWnd)<br>&nbsp; then Form1.ListBox1.Items.Add(StrPas(WndCaption)+':'+StrPas(ulpClassName));<br>&nbsp; Result := True;<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>&nbsp; enumchildwindows(findwindow(nil,'Form1'),@proc,0);<br>end;
 
顶部