我正在寻找一种方法来获取指定窗口中的所有句柄,
每个按钮和所有内容。我尝试使用EnumDesktopWindows,但它没有枚举每个句柄,只有窗口句柄。
问问题
469 次
2 回答
2
public Form1()
{
InitializeComponent();
List<IntPtr> handles = GetHandles(this.Controls);
}
public List<IntPtr> GetHandles(Control.ControlCollection inControls)
{
List<IntPtr> list_of_handles = new List<IntPtr>();
if(inControls != null)
{
foreach (Control c in inControls)
{
list_of_handles.Add(c.Handle);
list_of_handles.AddRange(GetHandles(c.Controls));
}
}
return list_of_handles;
}
于 2010-01-07T12:45:01.357 回答
0
我认为他正在尝试获取另一个窗口的句柄,而不是他的窗口
于 2010-01-07T12:37:53.287 回答