Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Problem with WebBrowser2 based class

Posted on 2003-10-28
Medium Priority
Last Modified: 2007-12-19

I have built a class to make the WebBrowser2 and accompanying objects a bit easier to use.  Basically I have handled all the bstr conversion operations necessary to open, close, navigate and so forth inside of class functions so that all operations can be done without having to go through the mess associated.  I have a second class that stores the document elements broken down into dropdowns, textboxes and so forth so that interacting with the document like entering text, selecting options and clicking buttons and hyperlinks can all be a simple one-liner.  I have had one problem from the beginning.  After having navigated with the browser there are always several:

First-chance exception in SuperManager.exe (KERNEL32.DLL): 0x80010108: (no name).

that come up when I close the browser.  After quitting the debugger I get an object dump.  The place of allocation is never given and I have checked and rechecked and it seems that none of my internally allocated stuff gets left over.  The contents of the dump usually contain urls, textbox names, hyperlink texts and so forth.   Any ideas what could be causing this?  I will include the following example function for you to look over and see if I leave the potential of having something left allocated.

int WebDocument::ClickHyperlink(const char *label)
      int i;
      BSTR bstr;

      char *string;

      HRESULT hr=0;

      for (i=0; i<nHyperlinks; i++)      {
            hr = pHyperlink[i]->get_innerText(&bstr);
            if(hr!=S_OK) return 1000;

            if(bstr==NULL) continue;

            string = ConvertBSTRToString(bstr);
            if(strcmp(string, label)==0)            {
                  hr = pHyperlink[i]->click();
                  if(hr!=S_OK) return 1001;

            delete[] string;
      if(i==nHyperlinks+1) return 1002; //Not found
      return 1;

The others follow a similar format.

This problem just means I have a memory leak.  The second problem is more limiting.  I have started using these classes inside worker threads.  I have a pBrowser object attached to theApp and I use it throughout the application when I need to interact with the web.  I have had no problem with sharing an open browser inside the main application thread, but after using it once in a worker thread it is rendered useless.  When the thread closes I get again a bunch of:

First-chance exception in SuperManager.exe (KERNEL32.DLL): 0x80010108: (no name).

When I try to navigate again I get:

First-chance exception in SuperManager.exe (KERNEL32.DLL): 0x800401FD: (no name).
First-chance exception in SuperManager.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.

One of them is probably thrown by me and used to handle the error.

Any ideas?  Are the two problems connected?

Thanks. David
Question by:david_johns
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 86

Expert Comment

ID: 9637325
>>Any ideas?  Are the two problems connected?

If it is only a First-chance exception, you may safely ignore that. See http://support.microsoft.com/default.aspx?scid=kb;en-us;105675 ("105675 - INFO: First and Second Chance Exception Handling")

Author Comment

ID: 9639577

Thanks for the insight.  I was not so much worried about the exceptions as I was about the memory dumps, and I guess I assumed that they were connected to each other.  Perhaps that is not really the case.  Any ideas from anyone about the leaks or the reason using it by another thread makes the browser unavailable for future use?

Thanks. David

Author Comment

ID: 9641381
I was able to find the memory leaks.  They were afterall my mistake.  I still have the same problem with trying to re-use the open browser, however, after running it from a seperate thread.  Are the com pointers somehow not threadsafe?

Thanks. David
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 86

Accepted Solution

jkr earned 1100 total points
ID: 9642277
>>Are the com pointers somehow not threadsafe?

That depends on the COM object they are pointing to - see http://support.microsoft.com/default.aspx?scid=kb;en-us;150777 ("INFO: Descriptions and Workings of OLE Threading Models")

Author Comment

ID: 9660342

Sorry for the lack of feedback.  I was hoping for a more comprehensive answer like the one you gave in the sequil to this thread:


Thanks for you help.

LVL 86

Expert Comment

ID: 9660389
Thank you!

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question