GetClassName获得的是在Windows系统中注册的窗口类名,是固定的,与程序中窗口的包装类名称不是一个概念。---------------- 你用这个 API 来读一下 Delphi 写的程序你就知道了
// 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 );
你只知道hwnd怎么会知道类型呢
char buff[256];
if(GetClassName(hwnd, buff, 256))
{
if(strcmp(buff, "Button") == 0) //button.
}
if(GetClassName(hwnd, buff, 256))
{
if(strcmp(buff, "Button") == 0) //button.
}--------------------
如果是 Delphi 的程序,那得到的類名是 TButton,我是問有沒有統一一點的方法?
你用这个 API 来读一下 Delphi 写的程序你就知道了
// 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
);
这些控件的CLASS NAME是固定的,
所以通过GetClassName返回的字符串一比较就知道。
这些控件的CLASS NAME是固定的,
所以通过GetClassName返回的字符串一比较就知道。-------------------------绝对不一样,对 Delphi 的程序就是不一样你用 Spy++ 看一下 Delphi 做的程序就知道了