简体   繁体   English

最小化“窗体”窗口状态时,Webbrowser控件引发异常

[英]Webbrowser control throws exception when Form windowstate is minimized

I am using WebBrowser control on a WinForm. 我在WinForm上使用WebBrowser控件。 When my form is minimized the control throws an exception, 当我的表单最小化时,控件将引发异常,

An outgoing call cannot be made since the application is dispatching an input-synchronous call. 由于应用程序正在分派输入同步呼叫,因此无法进行拨出呼叫。 (Exception from HRESULT: 0x8001010D (RPC_E_CANTCALLOUT_ININPUTSYNCCALL)) (来自HRESULT的异常:0x8001010D(RPC_E_CANTCALLOUT_ININPUTSYNCCALL))

I have stated windowstate as, 我说windowstate为,

this.WindowState = FormWindowState.Minimized;

Does anyone aware of this issue ? 有人知道这个问题吗?

Thanks in advance, 提前致谢,
Vijay 维杰

Where you want to modify UI from other thread use invoke method 您想从其他线程修改UI的地方使用invoke方法

        if (control.InvokeRequired)
        { 
            control.Invoke( (MethodInvoker)( ()=> control.updatingfunction() ) ;

        }
        else
        {
            control.updatingfunction();
        }

suppose you want to hide a panel (named panel1) from other thread. 假设您想从其他线程隐藏面板(名为panel1)。 Then your code will be 然后您的代码将是

       if (panel1.InvokeRequired)
        { 
            panel1.Invoke( (MethodInvoker)( ()=> panel1.Hide() )) ;

        }
        else
        {
            panel1.Hide();
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WebBrowser对象的内容在最小化表单然后恢复时会更改位置 - WebBrowser object content changes position when form is minimized and then restored .NET WinForms WebBrowser控件导航到IPv6地址时引发异常 - .NET WinForms WebBrowser control throws exception when navigating to IPv6 address 当 WindowState 设置为最大化时,部分窗体消失 - Parts of the form disappear when WindowState is set to maximized 当窗体不可见时如何修改WindowState - How to modify WindowState when the Form is not visible 使用Web浏览器控件时,Web服务将引发内部服务器错误 - Webservice throws internal server error when webbrowser control is used WebBrowser控件未添加到窗体 - WebBrowser Control not added to Form 在设计模式下控件大小较大时,Windows窗体将引发Argument异常 - Windows form throws Argument exception when the control size is larger in design mode WPF:SizeToContent =“WidthAndHeight”+ WindowState =“Minimized”Bug - WPF: SizeToContent=“WidthAndHeight” + WindowState=“Minimized” Bug 我想添加最小化按钮我的窗体不能使用Form1.WindowState = FormWindowState.Minimized; - c# i want add minimize button my form can't use Form1.WindowState = FormWindowState.Minimized; 当WindowState = Maximized时,lineNumbersCanvas.Width导致异常 - lineNumbersCanvas.Width Causing Exception When WindowState=Maximized
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM