2

I'm developing an IE BHO, While accessing frames in a html document i'm getting this error

Here is the code.

foreach (SHDocVw.InternetExplorer objExplorer in objShellWins)
{
   if (objExplorer.Document is HTMLDocument)
   {
      objDocument = (mshtml.HTMLDocument)objExplorer.Document;
      mshtml.HTMLDocument doc = (mshtml.HTMLDocument)objExplorer.Document;
      mshtml.FramesCollection frames = (mshtml.FramesCollection)doc.frames;  //Exception at this line
   }
}

what is the issue here ?

Narayan
  • 1,189
  • 6
  • 15
  • 33

1 Answers1

3

OK people i got it solved by setting [STAThread] at function calling

Narayan
  • 1,189
  • 6
  • 15
  • 33
  • May be it conflicts with Windows.forms webbrowser control and mshtml webbrowser, also check the access permission for frames. What exception you get ? – Narayan Mar 31 '15 at 05:24
  • The same which you are getting - specified cast is not valid exception. How to check access permission for frames? – Zameer Ansari Mar 31 '15 at 10:06