Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / November 2006

Tip: Looking for answers? Try searching our database.

REGDB_E_CLASSNOTREG error when accessing frames collection of IHTMLDocument2 on Windows XP via interop

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PhilC - 16 Nov 2006 08:28 GMT
Hi,

I've written some code to attempt to get the selected text from an HTML
document loaded in a running instance of IE. I need to be able to
access the frames collection of the IHTMLDocument2 interface so that I
can get text from the documents contained in the frames.

Here's what I've got:

using SHDocVw;
using mshtml;

           ShellWindows m_IEFoundBrowsers = new ShellWindowsClass();
           foreach (InternetExplorer Browser in m_IEFoundBrowsers)
           {

               if ((int)win.Window == Browser.HWND)
               {
                   m_IE = Browser as InternetExplorer;
                   browserExists = true;
                   break;
               }
           }
           if (!browserExists)
           {
               return;
           }
           IWebBrowser2 doc = m_IE as IWebBrowser2;
           IHTMLDocument2 hdoc = doc.Document as IHTMLDocument2;
           int frameNum = hdoc.frames.length;

The problem is, I get "Class not registered (Exception from HRESULT:
0x80040154 (REGDB_E_CLASSNOTREG))"}
System.SystemException {System.Runtime.InteropServices.COMException
on the final line, on the attempt to access the frames collection. This
works fine on Windows 2000, but this error occurs on Windows XP. How
can this class not be registered? Should I obtain the interface some
other way, without using SHDocVw?

Any help much appreciated!

Phil
PhilC - 18 Nov 2006 17:37 GMT
I've managed to get this working now but without requiring the frames
collection (by using IHtmlDocument2.ActiveElement, extracting the
IWebBrowser2 interface, and getting the internal document out that
way).

I'd still be curious to know why the frames collection was inaccessible
though.

Thanks

> Hi,
>
[quoted text clipped - 38 lines]
>
> Phil

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.