VC中如何使某一窗口始终居于其它窗口前面?

上前就我知道的也就是这两个办法,用的函数倒只是一个。

  1. 在WM_INITDIALOG的message handler中使用下面的函数就可以达到要求:
    SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
  2. 在CXXXView::OnLiftButtonDown()加入如下代码
    {
    ......
    CWnd m_pWnd=AfxGetMainWnd();

    m_pWnd->SetWindowPos( (m_pWnd->GetStyle( ) & WS_EX_TOPMOST),&wndNoTopMost: &wndTopMost,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);

    ......
    }