qexing
June 26th, 2005, 08:42 AM
I would like to show a Internet Explorer child window in my main window, and my codes are list here:
OleInitialize(NULL);
IWebBrowser2 * ppw = NULL;
IOleObject * ppo = NULL;
IOleClientSite * pmIOleClientSite = NULL;
DWORD m_dwCookie;
RECT rcOLE;
rcOLE.bottom = 300;
rcOLE.left = 0;
rcOLE.right = 400;
rcOLE.top = 0;
HRESULT a;
CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC,IID_IWebBrowser2,(void **) &ppw);
ppw->QueryInterface(IID_IOleObject,(void **) &ppo);
OleSetContainedObject((IUnknown *) ppw, TRUE);
ppo->SetClientSite(pmIOleClientSite);
a=ppo->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, pmIOleClientSite, NULL,hWnd,&rcOLE);
//******Always Error Here******//
AtlAdvise(ppw, GetUnknown(), DIID_DWebBrowserEvents2, &m_dwCookie);
ppw->Navigate(L"www.google.com", NULL, NULL, NULL, NULL);
ppw->Release();
OleUninitialize();
-----------------------------------------
It always returns an "GetUnknown--Undeclared identifier" error, and I don't know which is the base .h file.
While I replace "GetUnknown()" to "NULL", it just runs, however, it never shows a window and seems not connected to network.....
That's my problem, thank you!!!
OleInitialize(NULL);
IWebBrowser2 * ppw = NULL;
IOleObject * ppo = NULL;
IOleClientSite * pmIOleClientSite = NULL;
DWORD m_dwCookie;
RECT rcOLE;
rcOLE.bottom = 300;
rcOLE.left = 0;
rcOLE.right = 400;
rcOLE.top = 0;
HRESULT a;
CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC,IID_IWebBrowser2,(void **) &ppw);
ppw->QueryInterface(IID_IOleObject,(void **) &ppo);
OleSetContainedObject((IUnknown *) ppw, TRUE);
ppo->SetClientSite(pmIOleClientSite);
a=ppo->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, pmIOleClientSite, NULL,hWnd,&rcOLE);
//******Always Error Here******//
AtlAdvise(ppw, GetUnknown(), DIID_DWebBrowserEvents2, &m_dwCookie);
ppw->Navigate(L"www.google.com", NULL, NULL, NULL, NULL);
ppw->Release();
OleUninitialize();
-----------------------------------------
It always returns an "GetUnknown--Undeclared identifier" error, and I don't know which is the base .h file.
While I replace "GetUnknown()" to "NULL", it just runs, however, it never shows a window and seems not connected to network.....
That's my problem, thank you!!!