1

I'm attempting to host a web browser inside a dialog. I am using C++ with Win32 and ATL, no MFC. There is an ActiveX control (IWebBrowser2) that implements this functionality. The trick is it appears as though I need to create a dialog class that implements dozens of COM member functions to accomplish this. Is there no easier way? I've been looking at ATL (not I cannot use MFC otherwise I would use CDHtmlDialog) but haven't found any answers.

Adam Mitz
  • 6,025
  • 1
  • 29
  • 28
I have no cat
  • 226
  • 5
  • 13
  • Do you have any code to share? – Roman R. Jan 10 '12 at 06:12
  • Check this out - http://www.assembla.com/code/roatl-utilities/subversion/nodes/trunk/DispEventSample02/MainDlg.h. This is ATL+WTL too, and the code snippet is very compact. Basically you need `CAxDialogImpl` and sink interface. – Roman R. Jan 10 '12 at 06:20
  • I really like your code Roman! Unfortunately I cannot bring in a dependency on WTL. :( – I have no cat Jan 10 '12 at 22:53
  • There is little from WTL in this code fragment, all the important classes are from WTL (`CAxDialogImpl`, `IDispEventImpl`). – Roman R. Jan 11 '12 at 19:11

2 Answers2

0

Here's a CodeProject article that demonstrates the process: http://www.codeproject.com/KB/wtl/wtl4mfc6.aspx

It assumes you'll be using WTL but I think it could be used with only ATL. WTL is an extension of ATL.

Mark Ransom
  • 299,747
  • 42
  • 398
  • 622
  • I think at some point in past WTL started being usable without ATL (such as for example to be good for Express versions of Visual Studio too). – Roman R. Jan 10 '12 at 06:14
  • Thanks for the reply Mark. Unfortunately I cannot bring in a dependency on WTL. I'm looking at the code now trying to figure out how to accomplish this task with ATL only. – I have no cat Jan 10 '12 at 22:57
0

Here is an excellent tutorial on how to accomplish exactly what I am trying to do. Specifically it explains how to create a Dialog using ATL but not WTL or MFC that hosts a web browser (via IWebBrowser2).

http://www.arstdesign.com/articles/Win32_dialoghelpers.html

I have no cat
  • 226
  • 5
  • 13