110,533
社区成员
发帖
与我相关
我的任务
分享
AutomationElement aeDeskTop = AutomationElement.RootElement;
// 不设定查找条件,列出所有窗体
this.textBox1.AppendText("\r\n");
AutomationElementCollection elementCollection = aeDeskTop.FindAll(TreeScope.Children, Condition.TrueCondition);
foreach (AutomationElement frm in elementCollection)
{
this.textBox1.AppendText(string.Format("窗体名称:{0}\r\n", frm.Current.Name));
if (frm.Current.Name == "豆干") //这里是打开的QQ窗体的名称
{
elementCollection = frm.FindAll(TreeScope.Subtree,
Condition.TrueCondition);
foreach (AutomationElement control in elementCollection)
{
this.textBox1.AppendText(string.Format("控件id:{0}\r\n", control.Current.AutomationId));
}
}
}
//从网上找到的输入文本内容
System.Windows.Forms.SendKeys.SendWait(textBox2.Text);
//从网上找到的点击发送消息按钮
InvokePattern ipClickButton1 = (InvokePattern)aeAllEdit1[t].GetCurrentPattern(InvokePattern.Pattern);
ipClickButton1.Invoke();
//这两步都无法实现