참고 : http://computer-programming-forum.com/82-mfc/20b17af03936f1e8.htm
You can get the IWebBrowser2 from the CWebBrowser2 something like this…
IWebBrowser2* GetIWebBrowser2FromCWebBrowser2(CWebBrowser2& wndBrowser)
{
IWebBrowser2* piWebBrowser2=NULL;
if (LPUNKNOWN pUnk = wndBrowser.GetControlUnknown())
{
if (SUCCEEDED(pUnk->QueryInterface(
IID_IWebBrowser2, (void**)&piWebBrowser2)))
{
// Remember to call Release
return piWebBrowser2;
}
}
return NULL;
}
And call it something like this…
if (IWebBrowser2* piWB2 = GetIWebBrowser2FromCWebBrowser2(
m_wndBrowser))
{
piWB2->Release();
}
Where m_wndBrowser is an valid instance of a CWebBrowser2.