tags:

views:

57

answers:

0

I'm having a strange problem with WebBrowser control in a simple ATL application. I'm using the CAxWindow to create the web control. Everything works fine except that the browser always shows up as a POPUP window at the top left corner of the screen instead of within my main window as a child.

My main window is created with these styles: WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN. The child window hosting the CAxWindow is then created with WS_CHILD | WS_VISIBLE. It does show up correctly as a child of the main window. Then I do this:

CAxWindow axbrowser;
axbrowser.Attach(m_hChildWnd);
axbrowser.CreateControl(_T("http://www.google.com"));

The browser is created completely out of the main window and to the top left corner of the screen.