如何使用C#访问另一个应用程序的菜单栏

How to access the menu bar of another application with c#
2021-09-15
  •  译文(汉语)
  •  原文(英语)

我当前正在编写一个应用程序,该应用程序将帮助自动安装各种软件.此过程包括启动另一个应用程序,然后访问菜单栏以访问打开命令.我知道如何打开应用程序,但是任何人都可以帮助您访问菜单栏吗?任何帮助表示赞赏.

速聊1:
解决过程1

您可以使用一个特殊的API,我相信它是Windows Automation API.

解决过程2

一种方法是将按键发送到应用程序,假设应用程序使用其菜单选项的键盘快捷键.例如,在许多应用中,您可以使用ALT+F打开文件菜单,然后S使用保存或X退出等.

速聊1:
人们可能会从SO中具有16.9k代表的人那里得到比这更好的东西.对不起,老兄,我不是要冒犯您,这只是我的意见

I'm current writing an application that will help automate the installation of various software. This process includes starting another application and then accessing the menu bar to access the open command. I know how to open the application, but can anybody help with how to access the menu bar? Any help is appreciated.

Talk1:
possible duplicate of C# WinAPI Clicking on menu items
Solutions1

There's a special API you can use for that, I believe it's the Windows Automation API.

Solutions2

One way would be to send key-strokes to the application, assuming the application uses keyboard shortcuts for its menu options. For example, in many apps you can use ALT+F to open the file menu, and then S to Save or X to exit, etc.

Talk1:
One would expect something much better than this coming from someone with 16.9k rep in SO. Im sorry dude, I don't mean to offend you, its just my opinion
转载于:https://stackoverflow.com/questions/15560365/how-to-access-the-menu-bar-of-another-application-with-c-sharp

本人是.net程序员,因为英语不行,使用工具翻译,希望对有需要的人有所帮助
如果本文质量不好,还请谅解,毕竟这些操作还是比较费时的,英语较好的可以看原文

留言回复
我们只提供高质量资源,素材,源码,坚持 下了就能用 原则,让客户花了钱觉得值
上班时间 : 周一至周五9:00-17:30 期待您的加入