AfxGetMainWnd()->SetWindowPos(&CWnd::wndTopMost,0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);

解决方案 »

  1.   

     SetWindowPos函数,指定窗口的 最顶风格,用WS_EX_TOPMOST扩展窗口的风格
     Example:
     void ToggleTopMost(
    CWnd *pWnd)
     {
    ASSERT_VALID(pWnd)
    pWnd ->SetWindowPos(pWnd-> GetStyle( ) &WS_EX_TOPMOST)?
    &wndNoTopMOST: &wndTopMost,0,0,0,0,SSP_NOSIZE|WSP_NOMOVE)
     }
      

  2.   

    SetWindowPos()函数,其中hWndInsertAfter=HWND_TOPMOST
      

  3.   

    方式一:BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    if( !CFrameWnd::PreCreateWindow(cs) )
    return FALSE;
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs    cs.style = WS_OVERLAPPEDWINDOW  | WS_SYSMENU | WS_BORDER;
        // Size the window to 1/3 screen size and center it 
        cs.cy =::GetSystemMetrics(SM_CYSCREEN) * 4/5; 
        cs.cx =::GetSystemMetrics(SM_CXSCREEN) * 4/5; 
        cs.y = (GetSystemMetrics(SM_CYSCREEN) - cs.cy) / 2; 
        cs.x = (GetSystemMetrics(SM_CXSCREEN) - cs.cx) / 2;
    cs.dwExStyle= cs.dwExStyle | WS_EX_TOPMOST   ;   //注意这里
    return TRUE;
    }方法之二:
        
       this->SetWindowPos(......)希望能帮助你, :)