获取窗口句柄

 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. 
 

你可能感兴趣的:(窗口句柄)