Reputation: 3938
I'm new to MFC and ActiveX. I'm trying to use a 3rd party ActiveX control in my MFC application.
I successfully did it using a dialog-based MFC Application,
but it doesn't work if I select 'Single document' when creating a new MFC project(solution) in Visual Studio.
1. How can I use a 3rd-party ActiveX control if I want to create a 'single/multiple document' MFC application?
2. What is the idiomatic way to use 3rd-party ActiveX control with C++? (it's ok even if it's not MFC)
I really appreciate any help.
Upvotes: 0
Views: 239
Reputation: 3938
@Ed Dore's answer works, but if you wanna do this by code,
declare an instance of your control's wrapper class, and use the Create() function of it.
Now you don't need any dialog window(CDialogEx) or CFormView,
and also don't need DDX stuff.
Upvotes: 0
Reputation: 2109
The easiest way to integrate/support controls (and activeX controls) in your MFC SDI application, is to derive your view class from CFormView. That will allow you to add Win32 and ActiveX controls to your form window, similar to how you did it with a dialog-based application.
When you create a new MFC SDI application, ensure the "ActiveX Controls" checkbox is checked in the Advanced Features section of the wizard. Then in the "Generated Classes" section change the base class for your view class to CFormView.
This will give you a dialog resource (for your view), which you can drag/drop Win32 or ActiveX controls onto.
Sincerely,
Upvotes: 1