40ft集装箱尺寸比例:Findwindow 函数问题

来源:百度文库 编辑:高考问答 时间:2024/05/05 20:26: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 target window is owned by another process and has a caption, GetWindowText retrieves the window caption text.
(如果GetWindowText的目标窗口属于当前进程,那么GetWindowText将向该进程的窗口发送一个WM_GETTEXT消息,如果目标窗口是
其他进程的窗口,他才返回该窗口的标题)

FindWindowEx第3个参数是窗口的类名,第4个参数是窗口的标题.一般第3各参数为空字符串,只提供窗口标题就可以了。VB没用过,如有错误还请指正