如何使 CDHTMLDialog 隐藏直到页面加载?

发布于 2024-10-09 13:02:37 字数 67 浏览 0 评论 0原文

调用 DoModal 方法后,将立即显示对话框。但我需要使其不可见,直到页面加载。这可能吗?

谢谢 xx

after calling the DoModal method the dialog will be shown immediately. but i need to make it invisible until the page is loaded. is that possible?

thanks
xx

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

娇纵 2024-10-16 13:02:37

您好,您可以在开始时将其隐藏

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

,然后在 OnNavigateComplete 中使其可见。
但是,如果您的页面加载速度缓慢,则看起来就像您的应用程序挂起

Hi you can make it hidden at start in

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

and then in OnNavigateComplete make it visible.
But if your page will load slow it will seems like your app hangup

月下伊人醉 2024-10-16 13:02:37
//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);
}
//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);
}
幸福丶如此 2024-10-16 13:02:37
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();
}
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();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文