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函數獲得更多的錯誤信息。
|