ui-automation – Microsoft UI Automation:调用模式异常
发布时间:2020-07-21 06:27:45 所属栏目:Windows 来源:互联网
导读:我试图使用调用模式单击一个按钮. InvokePattern ipAddMPButton = (InvokePattern)aeAddMPButton.GetCurrentPattern(InvokePattern.Pattern); try { ipAddMPButton .Invoke(); } catch
|
我试图使用调用模式单击一个按钮. InvokePattern ipAddMPButton = (InvokePattern)aeAddMPButton.GetCurrentPattern(InvokePattern.Pattern);
try
{
ipAddMPButton .Invoke();
}
catch (System.Runtime.InteropServices.COMException e)
{
// TODO
}
它抛出COMException,我无法弄清楚为什么? 当我运行此代码时,按钮实际上被按下,功能正常.但随后它会停止一段时间,并抛出此异常. 实际上我发现这已经在这里讨论了: https://social.msdn.microsoft.com/Forums/en-US/673bba3d-27b3-4374-b049-0d2e8ec5e462/hang-with-invokepattern-invoke-in-virtual-pc?forum=windowsaccessibilityandautomation.总而言之,Winforms打开模态对话框与UIAutomation不能很好地协作,因为它不会从Invoke命令返回,只会创建模式对话框,这当然会阻止它完成操作.建议的解决方案是生成后台线程并从该线程激活Invoke(或任何其他操作).我还建议在完成操作时强制执行某种超时,因为在某些情况下它可能很长.(编辑:鲜蔬坊站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Windows下使用service.bat安装tomcat服务, 启动停止tomcat服
- Windows Phone 8.1 cordova下拉列表无法正常工作
- Windows Filtering Platform用户模式或内核模式?
- 程序集 – MZ(DOS,16位).EXE标头中页面计数和最后一页大小的
- windows – 为cmd启用颜色输出
- Windows – 如何使输出显示在Visual Studio 2005的错误列表
- .net – 为什么我无法在2.0.0.0播放器框架中重用1.8.2.2 Pl
- WIN2000 Apache php mysql 安装及安全手册
- windows-phone-7 – 如何做这样的事情? (应用程序内的瓷砖
- 如何在Windows中使用golang获取文件描述(产品名称,原始filn
推荐文章
站长推荐
- windows – 当磁盘上的文件发生更改时,Emacs挂起
- Windows下搭建以太坊私有链环境1.8.2
- 引用子项目的所有项目都必须安装NuGet软件包Micr
- .net – Windows Azure Web角色缓存(预览)“挂起
- cygwin – 用Cywgin启动X.
- 无法加载Microsoft.WindowsAzure.ServiceRuntime
- windows – 如何在Python cmd行应用程序上创建静
- windows – procdump -t – 如何在进程终止时转储
- windows-phone-7 – Caliburn Micro中的墓碑
- 如何在Windows 8.1上安装PyBluez?
热点阅读
