让程序窗口总是在最前面

UpdateData(true);

 if(m_bTopMost)
 {
  AfxGetMainWnd()->SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);
  m_bTopMost=true;
 }
 else
 {
  AfxGetMainWnd()->SetWindowPos(&CWnd::wndNoTopMost ,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);
  m_bTopMost=false;
 }
  
 ::WritePrivateProfileString("Settings","bTopMost",m_bTopMost ? "1":"0",".\\Settings.ini"); 

你可能感兴趣的:(程序)