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 ?

1
  • What is the error message from the exception? Commented Oct 9, 2013 at 9:18

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

2 Comments

May be it conflicts with Windows.forms webbrowser control and mshtml webbrowser, also check the access permission for frames. What exception you get ?
The same which you are getting - specified cast is not valid exception. How to check access permission for frames?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.