containing an IE browser control
"addicted2freefall" <addicted2freefall-/[email protected]>
| Newsgroups | gmane.comp.windows.wtl |
|---|---|
| Message-ID | <[email protected]> |
I've written a quick class to contain an IE browser control
class Browser : public CWindowImpl<Browser, CAxWindow>
{
public:
DECLARE_WND_SUPERCLASS(_T("BrowserCntr"), CAxWindow::GetWndClassName());
BOOL PreTranslateMessage( MSG* pMsg )
{
pMsg;
return FALSE;
}
HWND Create(
HWND hwndOwner,
RECT& rcPos,
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
DWORD dwExStyle = WS_EX_CLIENTEDGE,
UINT nID = 0,
LPVOID lpCreateParam = NULL
)
{
HWND hWnd = CWindowImpl<Browser, CAxWindow>::Create(
hwndOwner,
rcPos,
_T("{8856F961-340A-11D0-A96B-00C04FD705A2}"),
dwStyle,
dwExStyle
);
return hWnd;
}
BEGIN_MSG_MAP( Browser )
END_MSG_MAP()
};
When I attempt to add an instance of the Browser to my CMainFrame, the browser control sits on the desktop:
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CComQIPtr<IWebBrowser2> m_spBrowser;
CComVariant v;
RECT rect;
GetClientRect(&rect);
m_hWndClient = m_browser.Create( m_hWnd, rect );
m_browser.QueryControl( &m_spBrowser );
if( m_spBrowser )
m_spBrowser->Navigate( CComBSTR("http://www.google.com"), &v, &v, &v, &v);
// register object for message filtering and idle updates
CMessageLoop* pLoop = _Module.GetMessageLoop();
ATLASSERT(pLoop != NULL);
pLoop->AddMessageFilter(this);
pLoop->AddIdleHandler(this);
return 0;
}
How can I ensure that it's a child window of the CMainFrame - e.g. the m_hWndClient window?
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/wtl/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/wtl/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/