c# specified cast is not valid while assigning mshtml.HTMLDocument.frames
问题 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: OK people i got it