怎么从一个 HWND 得到这个窗体(控件)的类型 ?如 Window, Buttom ,CheckBox

如何从一个 HWND 得到这个窗体(控件)的类型 ?如 Window, Buttom ,CheckBox
如何从一个 HWND 得到这个窗体(控件)的类型 ?如 Window, Buttom ,CheckBox

我 EnumChildWindow 得到了所有控件的句柄,我现在想从这个句柄,得知这个 HWND 是什么类型 的东东
比如: Button ,CheckBox ???

------解决方案--------------------
用API函数中的GetClassName()函数就可以得到当前的基本空间的api类名了。
------解决方案--------------------
Button ,CheckBox 的基类都是cwnd
你只知道hwnd怎么会知道类型呢
------解决方案--------------------
GetClassName获得的是在Windows系统中注册的窗口类名,是固定的,与程序中窗口的包装类名称不是一个概念。
------解决方案--------------------
C/C++ code
// GetClassName
// The GetClassName function retrieves the name of the class to which the specified window belongs. 

int GetClassName(
  HWND hWnd,           // handle of window
  LPTSTR lpClassName,  // address of buffer for class name
  int nMaxCount        // size of buffer, in characters
);

------解决方案--------------------
Window, Buttom ,CheckBox 
这些控件的CLASS NAME是固定的,
所以通过GetClassName返回的字符串一比较就知道。
------解决方案--------------------
//是的,不同开发工具得到的类名可能不同。
//不可能有统一的标准
//只能得到注册时的类名信息。