日期:2014-05-20  浏览次数:20949 次

WinForm中怎么用API判断一个控件是Button还是CheckBox还是RadioButton??
我试过用GetClassName函数.但是不行.取到的都是:xxxxxx.BUTTON.app3
看了下MSDN:如下
System.Object
      System.MarshalByRefObject
            System.ComponentModel.Component
                  System.Windows.Forms.Control
                        System.Windows.Forms.ButtonBase
                              System.Windows.Forms.Button
                              System.Windows.Forms.CheckBox
                              System.Windows.Forms.RadioButton
为什么取出来的都是BUTTON啊...有什么方法用API函数判断吗??????
谢谢各位!!

------解决方案--------------------
use win32 function "AccessibleObjectFromPoint " get the acc object.
then use "acc_Role " property to get the role type.