The FindWindow function retrieves a handle to the top-level window whose class name and window name match the
specified strings. This function does not search child windows. This function does not perform a case-sensitive
search.
FindWindow函数根据给定的窗体类名称、窗体名称的字符串搜索父窗体并返回其窗体句柄。这个函数并不搜索子窗体。这个函数并不
完成一个事件感知的搜索。
To search child windows, beginning with a specified child window, use the FindWindowEx function.
要搜索给定窗体的子窗体,使用FindWindowEx函数。
Syntax
语法
HWND FindWindow(
LPCTSTR lpClassName,
LPCTSTR lpWindowName
);
Parameters
参数
lpClassName
[in] Pointer to a null-terminated string that specifies the class name or a class atom created by a previous call to
the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order
word must be zero.
[输入]一个以零作为终结符的字符串指针,给定窗体的类名称或由先前执行RegisterClass或RegisterClassEx函数创建的类原子,类
原子的低位两个字节必须是lpClassName参数,高位两个字节必须是零。
If lpClassName points to a string, it specifies the window class name. The class name can be any name registered
with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
如果lpClassName指针指向字符串,它就给定了窗体的类名称。类名称可以是RegisterClass或RegisterClassEx注册的任意名称,或
者是任何预先定义好的控件类名称。
If lpClassName is NULL, it finds any window whose title matches the lpWindowName parameter.
如果lpClassName是空指针,函数将按照lpWindowName参数搜索所有窗体。
lpWindowName
[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.
[输入]一个以零作为终结符的字符串指针,给定窗体名称(标题)。如果这个参数是空指针,函数搜索时将忽略窗体名称。
Return Value
函数返回值
If the function succeeds, the return value is a handle to the window that has the specified class name and window
name.
如果函数执行成功,返回值是一个给定的窗体类名称和窗体名称的窗体句柄。
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
如果函数执行失败,返回值为零。执行GetLastError函数获得更多的错误信息。
|