且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

让窗口保持在最前

更新时间:2022-09-13 23:16:05

这里主要用到了一个函数:

BOOL SetWindowPos( const CWnd* pWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags);

具体用法可以参看MSDN

 

void CSYSLoaderDlg::OnCheckFront() 
{
// TODO: Add your control notification handler code here
if (m_checked == TRUE)
{
m_checked = FALSE;
SetWindowPos(&CWnd::wndNoTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); 
}
else
{
m_checked = TRUE;
SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); 
}
}