1. 程式人生 > >findwindow(api)的具體用法

findwindow(api)的具體用法

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函式獲得更多的錯誤資訊。