Findwindow 函数问题

来源:百度知道 编辑:UC知道 时间:2024/05/18 05:58:55
在VB6中建一个FORM1窗体,运行后

hwnd = FindWindowEx(0, 0, vbNullString, "form1")
能找到这个窗体句柄

hwnd = FindWindowEx(0, 0, "ThunderRT6FormDC", "form1")
或者
hwnd = FindWindowEx(0, 0, "ThunderRT6FormDC", VBnullstring)
都不能找到这个窗口句柄为什么?

PS:不要说用form1.hwnd

//函数原形
HWND FindWindowEx( HWND hwndParent,
HWND hwndChildAfter,
LPCTSTR lpszClass,
LPCTSTR lpszWindow
);

//最后一个参数说明
lpszWindow
[in] Pointer to a null-terminated string that specifies the window name (the window's title). If this parameter is NULL, all window names match.

(lpszWindow是一个以null结尾的字符串,这个字符串包含有窗口的名字。如果这个参数是NULL(vbNullString),那么所有的窗口都符合条

件)

注意:
If the lpszWindow parameter is not NULL, FindWindowEx calls the GetWindowText function to retrieve the window name for comparison. For a

description of a potential problem that can arise, see the Remarks section of GetWindowText.
(如果lpszWindow是NULL,FindWindowEx将调用GetWindowText来返回一个窗口的名字代替lpszWindow,...)

GetWindowText的Remarks部分:
If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or

control. If the targe