Home > Back-end > Help SHDocVw. Webrowser interface event, for less than the document. The frames
Help SHDocVw. Webrowser interface event, for less than the document. The frames
Time:10-03
I was written in c #.
Public static SHDocVw. WebBrowser GetIEWeb (IntPtr han) { Int lRes=0; Var app2_GenerateEvent=Win32API. RegisterWindowMessage (" WM_HTML_GETOBJECT "); Win32API. SendMessageTimeout (han, app2_GenerateEvent, IntPtr. Zero, IntPtr. Zero, Win32API. SendMessageTimeoutFlags. SMTO_ABORTIFHUNG, 1000, ref lRes); The object obj=null; System. The Guid Guid=new Guid (" ce 6 d5140c1-7436-11-8034-00 aa006009fa "); Win32API. ObjectFromLresult (lRes, ref guid, 0, ref obj); IServiceProvider sp=obj as IServiceProvider; The object o; Sp. QueryService (new Guid (" 0002 df05-0000-0000 - C000-000000000046 "), New Guid (" D30C1661 d0 CDAF - 11-8 a3e - 00 c04fc9e26e "), Out o); The return o as SHDocVw. WebBrowser; }
By this code to obtain the Iwebrowser2 interface, transformed into WebBrowser interface, and registered the BeforeNavigate2 event. The odd thing is that when I was in part program execution of code can access to the document. The Frames properties. (that is, in my program execution time) (that is, in IE events snippet in IE program execution time) to obtain the document. The Frames are always type errors. Should be the underlying COM interface IHTMLDocument2_get_frames () method performs the exception, did not get to the correct values.
How to correctly again IE event code for Frame? Because I have to read the inside of the frame. But now I can't get frame. I tried, you use getElementById (framID) get HtmlFrameElement unable to get inside the frame content. The. Let alone change..