让窗口保持在最前

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

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); 
}
}
原文地址:https://www.cnblogs.com/lidabo/p/3573016.html