Webbrowser control throws exception when Form windowstate is minimized

1

I am using WebBrowser control on a WinForm. 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))

I have stated windowstate as,

this.WindowState = FormWindowState.Minimized;

Does anyone aware of this issue ?

Thanks in advance,
Vijay

c#
winforms
webbrowser-control
asked on Stack Overflow May 31, 2012 by Vijay Balkawade

1 Answer

0

Where you want to modify UI from other thread use invoke method

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

        }
        else
        {
            control.updatingfunction();
        }

suppose you want to hide a panel (named panel1) from other thread. Then your code will be

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

        }
        else
        {
            panel1.Hide();
        }

User contributions licensed under CC BY-SA 3.0