How to enable 'Insert Activex Control' in

2019-07-06 00:26发布

I am new to ActiveX Controls, though I have some basic background in COM/ATL programming.

Steps

The project is a simple Win32 project created using the Visual Studio 2012 wizard. I have selected all the default options. The dialog box is created using the resource editor dialog and then selecting new dialog option.

Problem

In my application I want to host the Internet Explorer (or some other) activex control in a dialog box. But the problem is that when I right click (as suggested by many sites and even msdn) the insert activex control ... is always disabled. I am not using MFC, but instead CAxDialogImpl (as described here).

Please suggest what I am doing wrong? How can I enable insert activex control ... in Visual Studio 2012 dialog editor?

enter image description here

2条回答
不美不萌又怎样
2楼-- · 2019-07-06 00:50

I took considerable time to enable it, but the answer is simple: remove the macro "_APS_NO_MFC" in "resource.h" file.

查看更多
欢心
3楼-- · 2019-07-06 00:57

A plain Win32 dialog does not have ActiveX container support, so the resource editor will not let you add the control.

You'll need to create a second project like an MFC dialog-based app, then copy the control information from its RC file.

CodeProject has some articles on using ActiveX controls without MFC, such as this one using parts of ATL - Win32 dialog helpers or this one that's pure C++ but similar to ATL's AxWindow - Use an ActiveX control in your Win32...

查看更多
登录 后发表回答