I use ATL in Visual C ++ 10 to control the browser. My code is similar to this example: http://msdn.microsoft.com/en-us/library/9d0714y1(v=vs.80).aspx
The difference is that I have a main window, and then the child window contains a browser control. After 2 minutes, I need to close the browser, completely kill the activeX browser, but this child window should be alive and do something else. But somehow this browser control is still there, I can see the scroll bars or something like that.
I also tried to create a child window to an existing child window, and when I close the browser I will destroy this child of the child, but still it does not work!
Here is how I close:
CLOSE() { m_spIWebBrowser2->Navigate(bstrURL, &vEmpty, &vEmpty, &vEmpty, &vEmpty); m_spIWebBrowser2->Stop(); m_spIWebBrowser2->put_Visible(VARIANT_FALSE); m_spIWebBrowser2->Quit(); DestroyWindow(m_wndChild.m_hWnd); }
Thanks!
source share