如何从我没有API的WinForm应用程序中获取RadioButton的值?

如何从我没有API的WinForm应用程序中获取RadioButton的值?

问题描述:

我有一个小型计算系统,该系统将安装在多台PC中.这些PC中装有一个程序,并且该程序始终处于打开状态(但已最小化).

I have a small calculation system that will be installed in multiple PCs. Those PCs have a program installed in them and this program is always open (but minimized).

我需要在该程序中获取'RadioButton'的值,但是我无法访问它!

I need to get the value of a 'RadioButton' in this program but I can't access it!

我试图为该应用程序获取API,但该公司开发了它拒绝合作.我有个疯狂的主意,您可以参考关于这个主意的问题

I've tried to get an API for this application but the company developed it refused to co-operate. I've got a crazy idea, you can refer to my question regarding this idea Click It and the last thing is to get the cache for the button but I think this is going to work with WebApplications only!

任何帮助都是伟大的!=)..顺便说一句,我决定将我的应用程序构建为Web应用程序,但是由于截图,我改变了主意将其构建为WinForms.但是,如果我有一个更好,更干净的解决方案,我会回到WebApp

Any help would be Great! =) .. And btw I decided to build my application as web application but then I changed my mind to build it as a WinForms because of the screenshot. But if I got a better and a more clean solution I'd go back to WebApp

抓屏不是一个好的选择.如果应用程序使用窗口控件,则应该能够使用基于 FindWindow 的方法来控制单选按钮.如果不是这样,那么UI Automation可能很好地获得单选按钮的值.使用这种方法通常可以从另一个应用程序中读取UI状态,而且比屏幕抓取要容易得多.

Screen grabbing is not a good option. You should be able to use FindWindow based methods to get hold of the radio button if the app uses windowed controls. If not then UI Automation may very well be able to get the value of the radio button. Whatever it's usually possible to read UI state out of another application with methods like this, and much easier than screen scraping.