How to enable 'Insert Activex Control' in Visual Studio 2012 for a Win32 Dialog based application?

无人久伴 提交于 2019-12-12 15:23:53

问题


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?


回答1:


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




回答2:


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...



来源:https://stackoverflow.com/questions/20466195/how-to-enable-insert-activex-control-in-visual-studio-2012-for-a-win32-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!