窗口置顶方法
Posted Everyone is not Read-only!
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了窗口置顶方法相关的知识,希望对你有一定的参考价值。
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 如果窗口为顶层窗口,则该窗口被激活;如果窗口为子窗口,则相应的顶级父窗口被激活。
以上是关于窗口置顶方法的主要内容,如果未能解决你的问题,请参考以下文章