views:

182

answers:

1

I am hosting the web browser control in my own window. Here are the pertinent steps:

CoGetClassObject(CLSID_WebBrowser, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER, NULL, IID_IClassFactory, (void **)&pClassFactory)

pClassFactory->CreateInstance(0, IID_IOleObject, (void **)&pObject);

pClassFactory->Release();

pObject->SetClientSite((IOleClientSite *)impl) OleSetContainedObject((struct IUnknown *)pObject, true) pObject->DoVerb(OLEIVERB_SHOW, NULL, (IOleClientSite *)impl, 0, hHpsWnd, &rect);

pWB->put_Visible(VARIANT_FALSE);

hr=pWB->Quit();

At the last statement above the hr return value is E_FAIL. The end result of this failure in my code is leaking of a bunch of resources. What am I doing incorrectly?

+1  A: 

Reading the documenation here it states the WebBrowser object (i.e. CLSID_WebBrowser) returns an error from the Quit method because it does not make sense in context. The Quit method will quit the out of process version of IE which also uses the same interface to communicate.

Only thing I can suggest is double check you are releasing all COM object relating to the browser.

tyranid
Thanks a lot. That makes sense. The leak issue also went away after I upgraded from IE v6 to IE v8.(unfortunately I am new to the site and I don't have enough points to upvote your answer, but do appreciate.)
Subhash Bhardwaj