No keyboard in IWebBrowser2
-
I'm hosting the IWebBrowser2 object in a window (based on CWindowImpl). the mouse works perfectly within the browser, as does all navigation, however, I can not type within a textbox on a web page. Do I have to implement IDispach:Invoke and then redirect all keyboard events back to the browser? If so, how? The relevant section of code for hosting the browser is class CTest : public CWindowImpl>Ctest< CTest() { Create( phWnd, rcClient, _T("Browser"), WS_CHILD | WS_VSCROLL | WS_HSCROLL); } HRESULT CTest::DoAddBrowser(CComVariant t_URL) { CAxWindow wnd(this->m_hWnd); HRESULT hr = wnd.CreateControl(IDH_DEFAULTPAGE); if (SUCCEEDED(hr)) { hr = wnd.QueryControl(IID_IWebBrowser2, reinterpret_cast(&m_pIWebBrowser)); return m_pIWebBrowser->Navigate2(&t_URL,NULL,NULL,NULL,NULL); } return hr; } }; Thanks Angus
-
I'm hosting the IWebBrowser2 object in a window (based on CWindowImpl). the mouse works perfectly within the browser, as does all navigation, however, I can not type within a textbox on a web page. Do I have to implement IDispach:Invoke and then redirect all keyboard events back to the browser? If so, how? The relevant section of code for hosting the browser is class CTest : public CWindowImpl>Ctest< CTest() { Create( phWnd, rcClient, _T("Browser"), WS_CHILD | WS_VSCROLL | WS_HSCROLL); } HRESULT CTest::DoAddBrowser(CComVariant t_URL) { CAxWindow wnd(this->m_hWnd); HRESULT hr = wnd.CreateControl(IDH_DEFAULTPAGE); if (SUCCEEDED(hr)) { hr = wnd.QueryControl(IID_IWebBrowser2, reinterpret_cast(&m_pIWebBrowser)); return m_pIWebBrowser->Navigate2(&t_URL,NULL,NULL,NULL,NULL); } return hr; } }; Thanks Angus
Check out KB article Q196339 for a sample that hosts the web browser and shows how to get the keyboard working. --Mike-- http://home.inreach.com/mdunn/ All your base are belong to ME~!