gpt4 book ai didi

.net - UI自动化中如何调用快捷键?/。网

转载 作者:行者123 更新时间:2023-12-03 23:05:31 27 4
gpt4 key购买 nike

我正在编写程序来自动化 win32 表单。我正在使用 Microsoft UI 自动化库。我不知道如何获取和调用该表单上的预定义快捷键。现在我只需获取 MenuItem 的 AutomationElement 并调用该元素上的单击。
任何解决方案?有人这样做吗?

最佳答案

据我所知 AutomationElementInformation 有一个 AcceleratorKey 和 AccessKey 属性。
MSDN 的一些摘录:

AutomationElement::AutomationElementInformation::AcceleratorKey
The sequence of key combinations that invoke an action associated with the element.



和:

AutomationElement::AutomationElementInformation::AccessKey
The character, associated with an element, that is used to activate that element.



之后就可以使用 SendKeys来模拟按键。

另一种方法是使用 keybd___event 但,AFAIK,它已被弃用,Microsoft 建议使用 SendInput反而。也许它会帮助你。

关于.net - UI自动化中如何调用快捷键?/。网,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1361406/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com