首页 文章

如何在加载页面之前隐藏CDHTMLDialog?

提问于
浏览
0

调用DoModal方法后,将立即显示该对话框 . 但我需要在页面加载之前使其不可见 . 那可能吗?

谢谢xx

3 回答

  • 0
    //CYourDialog.cpp
    
    void CYourDialog::OnWindowPosChanging(WINDOWPOS* lpwndpos)
    {
         //allow to hide dialog at the startup of dialog,
         //delay the show of dialog until m_bVisible is set
         if(!m_bVisible)
         {
             lpwndpos->flags &= ~SWP_SHOWWINDOW;
         }
    
         CDialog::OnWindowPosChanging(lpwndpos);
    }
    
    //CYourHtmlView.cpp
    
    void CYourHtmlView::OnDocumentComplete()
    {
        m_pYourDlg->m_bVisible=TRUE;
        m_pYourDlg->ShowWindow(SW_SHOW);
    }
    
  • 0

    嗨,你可以在开始时隐藏它

    OnInitDialog()
       DWORD dwStyle = GetWindowLong(GetSafeHwnd(), GWL_STYLE);
       dwStyle -= WS_VISIBLE;
       SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle);
    

    然后在 OnNavigateComplete 让它可见 . 但是,如果您的页面加载速度很慢,那么您的应用程序就会挂断

  • 0
    BOOL CYourDialog::OnInitDialog()
    {
        DWORD dwStyle = GetWindowLong(GetSafeHwnd(), GWL_STYLE);
        dwStyle -= WS_VISIBLE;
        SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle);
        Invalidate();
        CDHtmlDialog::OnInitDialog();
    ...
        Navigate(_T("www.google.com"));
        return TRUE;  // return TRUE  unless you set the focus to a control
    }
    
    void CYourDialog::OnNavigateComplete(LPDISPATCH pDisp, LPCTSTR szUrl)
    {   
        DWORD dwStyle = GetWindowLong(GetSafeHwnd(), GWL_STYLE);
        dwStyle += WS_VISIBLE;
        SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle);   
        Invalidate();
    }
    

相关问题