如何将击键发送到应用程序UI自动化-C# [英] How to send keystrokes to application UI automation -C#

查看:102
本文介绍了如何将击键发送到应用程序UI自动化-C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要找出键盘值的Automationid吗?如何将击键发送到应用程序UI自动化?我需要自动执行键盘上的上翻页和下翻页功能.最好的方法是什么 它?

i need to find out automationid for key board values? how to send keystrokes to application UI automation? i need to automate page up and page down function in key board. What is the best way to do it?

在我的应用程序中遵循该过程.假定最终用户打开5页的MS Word文档,然后按上一页和下一页按钮在这些页面中移动.我想使用C#自动执行此方案.目前,我已经使用UIAutomationClient.dll和UIAutomationTypes.dll.我可以使用这些吗?

in my application following the process. Assume end user open MS Word document with 5 pages and he presses page up and page down buttons to move within these pages. i want to automate this scenario using c#. currently i have uses UIAutomationClient.dll and UIAutomationTypes.dll. can i uses these?

推荐答案

在这种情况下,将word文档放到地面,然后在屏幕键盘上使用
System.Diagnostics.Process.Start("osk.exe");,然后使用鼠标输入单击上一页和下一页按钮 因为鼠标单击需要页面向上和向下按钮的屏幕坐标.

in this scenario get the word document to fore ground and then used on screen key board
System.Diagnostics.Process.Start("osk.exe");and click page up and down buttons using mouse input since for the mouse click need screen coordinates for the page up and down button.

(我试图使用UI自动化在屏幕键盘上进行检测.但是它没有检测到屏幕上的按键. https://stackoverflow.com/questions/11077738/windows-sdk-inspect-tool-what-are-the-reasons-on-screen-keyboard-does-not-disp 找不到解决此问题的方法.我使用此移动单击方法来单击按钮. )

( i tried to detect on screen key board using UI automation. but it did not detect keys of the screen. https://stackoverflow.com/questions/11077738/windows-sdk-inspect-tool-what-are-the-reasons-on-screen-keyboard-does-not-disp couldn't find solution for this problem.so because of that i use this move click method to click the button. )

这篇关于如何将击键发送到应用程序UI自动化-C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆