Hello
J'ai un problème avec ce code :
J'ai une exception "System.InvalidCastException".
Quelqu'un peut m'expliquer pourquoi svp ?
Merci d'avance....
Nara
Message="Unable to cast COM object of type
'mshtml.HTMLInputElementClass' to interface type
'mshtml.IHTMLInputImage'. This operation failed because the
QueryInterface call on the COM component for the interface with IID
'{3050F2C2-98B5-11CF-BB82-00AA00BDCE0B}' failed due to the following
error: Cette interface n'est pas prise en charge (Exception from
HRESULT: 0x80004002 (E_NOINTERFACE))."
Source="Microsoft.mshtml"
{
webBrowser1.Navigate("
http://www.google.com");
while ((webBrowser1.IsBusy) || (webBrowser1.ReadyState !=
WebBrowserReadyState.Complete))
{ Application.DoEvents(); };
for (int j = 0; j <= webBrowser1.Document.All.Count - 1; j++)
{
object obj;
mshtml.IHTMLInputImage intf;
obj = webBrowser1.Document.All[j].DomElement;
if (obj is mshtml.IHTMLInputImage)
{
intf = (obj as mshtml.IHTMLInputImage);
Debug.Assert(intf!=null);
MessageBox.Show(intf.name); // <-- This throw an exception
}
}
}