首页 > 代码库 > 窗口置顶方法
窗口置顶方法
CWindow::SetWindowPos
BOOL SetWindowPos( HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags );
BOOL SetWindowPos( HWND hWndInsertAfter, LPCRECT lpRect, UINT nFlags );
1 BOOL CXXX::OnInitDialog()2 {3 CRect rect;4 GetWindowRect(&rect);5 ::SetWindowPos(this->m_hWnd,HWND_TOPMOST,Rect.left,Rect.top,6 Rect.Width(),Rect.Height(),SWP_NOMOVE | SWP_NOSIZE);7 }
BringWindowToTop
This function brings the specified window to the top of the z-order. If the window is a top-level window, it is activated. If the window is a child window, the top-level parent window associated with the child window is activated.
BOOL BringWindowToTop( HWND hWnd );
Parameters
- hWnd
- Handle to the window to bring to the top of the z-order.
Return Values
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.
bringwindowtotop 如果窗口为顶层窗口,则该窗口被激活;如果窗口为子窗口,则相应的顶级父窗口被激活。
窗口置顶方法
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。