獲取窗口句柄

 1 this->m_hwnd

2 CWnd::GetSafeHwnd 獲取窗口類的窗口句柄
HWND GetSafeHwnd( ) const;
Returns m_hWnd, or NULL if the this pointer is NULL.
3       CWnd::SubclassWindow        動態子類化
BOOL SubclassWindow( HWND hWnd );
Call this member function to "dynamically subclass" a window and attach it to this CWnd object.
4    HWND GetForegroundWindow(VOID);  獲取當前窗口句柄
The GetForegroundWindow function returns a handle to the foreground window (the window with which the user is currently working). The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.  5        CWnd::GetActiveWindow       獲取活動窗口句柄static CWnd* PASCAL GetActiveWindow( ); Retrieves a pointer to the active window. 6      CWnd* AFXAPI AfxGetMainWnd( );     獲取主窗口句柄 If your application is an OLE server, call this function to retrieve a pointer to the active main window of the application instead of directly referring to the m_pMainWnd member of the application object.
HWND FindWindow( LPCTSTR lpClassName, LPCTSTR lpWindowName ); 查找指定窗口句柄

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.

To search child windows, beginning with a specified child window, use the FindWindowEx function.
8 BOOL EnumWindows( WNDENUMPROC lpEnumFunc, LPARAM lParam ); 枚舉窗口句柄
The EnumWindows function enumerates all top-level windows on the screen by passing the handle to each window, in turn, to an application-defined callback function. EnumWindows continues until the last top-level window is enumerated or the callback function returns FALSE. 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章