C#得到窗口句柄后遍历窗口控件句柄

来源:百度知道 编辑:UC知道 时间:2024/05/10 11:56:29

这个简单的

http://www.zu14.cn/2008/11/15/auto_qq_msg/

用个递归就完了.

public System.Collections.ArrayList handleList = new System.Collections.ArrayList();
public void GetHandle(Control.ControlCollection controls)
{
if (controls != null)
{
foreach (Control c in controls)
{
handleList.Add(c.Handle);
GetHandle(c.Controls);
}
}
else
{
return;
}
}

调用方法:
GetHandle(this.Controls);
然后所有的句柄就保存到handleList里面了.