单文档工程中,我创建了一个显示splash的类,我在CMainFrame的Create函数中显示splash
,但是为什么我的splash 不是在窗口的最前面,而是在单文档的后面呢?

解决方案 »

  1.   

    在开始用SPLASH窗口的时候隐藏主程序窗口,播放完了再显示
      

  2.   

    如何使窗口始终在最前方?
          两种途径.
           BringWindowToTop(Handle);
           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);
               }
      

  3.   

    先隐藏主程序窗口,SPLASH完了再显示
      

  4.   

    BOOL SetWindowPos(          HWND hWnd,
        HWND hWndInsertAfter,
        int X,
        int Y,
        int cx,
        int cy,
        UINT uFlags
    );::SetWindowPos(GetSafeHwnd,HWND_TOPMOST,0,0,0,0,WSP_NOSIZE|WSP_NOMOVE);
      

  5.   

    各位还是不行
    看看我的代码是不是有问题
    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    return -1;

    if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
    | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
    !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
    {
    TRACE0("Failed to create toolbar\n");
    return -1;      // fail to create
    } if (!m_wndStatusBar.Create(this) ||
    !m_wndStatusBar.SetIndicators(indicators,
      sizeof(indicators)/sizeof(UINT)))
    {
    TRACE0("Failed to create status bar\n");
    return -1;      // fail to create
    } // TODO: Delete these three lines if you don't want the toolbar to
    //  be dockable
    m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_wndToolBar);

    CWelcome::ShowSplashWnd(this);
    CWelcome::ToggleTopMost(this);
    //CWelcome::ShowSplashScreen(this);
    //Sleep(2000);
    return 0;
    }
      

  6.   

    如果上面使用Sleep()是可以显示在最前面的
    但是如果去掉的话,那么splash总是显示在后面
    不知是为什么