You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Learn more about: Add a class from an ActiveX control"
3
3
title: "Add a class from an ActiveX control"
4
-
ms.date: "11/08/2018"
4
+
ms.date: "03/01/2022"
5
5
f1_keywords: ["vc.codewiz.class.axcontrol"]
6
6
helpviewer_keywords: ["ActiveX controls [C++], adding classes", "classes [C++], creating", "ActiveX Control Wizard", "add class from ActiveX control wizard [C++]"]
7
7
ms.assetid: 729fcb37-54b8-44d5-9b4e-50bb16e0eea4
8
+
ms.custom: devdivchpfy22
8
9
---
9
10
# Add a class from an ActiveX control
10
11
11
12
Use this wizard to create an MFC class from an interface in an available ActiveX control. You can add an MFC class to an [MFC application](../mfc/reference/creating-an-mfc-application.md), an [MFC DLL](../mfc/reference/creating-an-mfc-dll-project.md), or an [MFC ActiveX control](../mfc/reference/creating-an-mfc-activex-control.md).
12
13
13
-
> [!WARNING]
14
-
> In Visual Studio 2017 version 15.9, Microsoft deprecated this code wizard, and we will remove it in a future version of Visual Studio. This wizard is rarely used. General support for ATL and MFC isn't impacted by the removal of this wizard. If you would like to share your feedback about this deprecation, complete [this survey](https://www.surveymonkey.com/r/QDWKKCN). Your feedback matters to us.
15
-
<!-- Blank comment here to separate the warning and note. -->
16
14
> [!NOTE]
17
15
> You don't need to create your MFC project with Automation enabled to add a class from an ActiveX control.
18
16
19
-
An ActiveX control is a reusable software component based on the Component Object Model (COM) that supports a wide variety of OLE functionality. It can be customized to fit many software needs. You may use ActiveX controls in ordinary ActiveX control containers or on the Internet in World Wide Web pages.
17
+
An ActiveX control is a reusable software component based on the Component Object Model (COM) that supports a wide variety of OLE functionality. You may use ActiveX controls in ordinary ActiveX control containers.
20
18
21
19
**To add an MFC class from an ActiveX control:**
22
20
23
21
1. In either **Solution Explorer** or [Class View](/visualstudio/ide/viewing-the-structure-of-code), right-click the name of the project to which you want to add the ActiveX control class.
24
22
25
-
1. From the shortcut menu, choose**Add**, and then choose**Add Class**.
23
+
1. From the shortcut menu, select**Add**, and then select**New Item**.
26
24
27
-
1. In the [Add Class](./adding-a-class-visual-cpp.md#add-class-dialog-box)dialog box, in the **Templates** pane, choose **MFC Class from ActiveX Control**, and then choose **Open** to display the [add class from ActiveX control wizard](#add-class-from-activex-control-wizard).
25
+
1. In the **Add New Item**dialog box, in the **Templates** pane, choose **MFC Class from ActiveX Control**, and then choose **Add** to display the [add class from ActiveX control wizard](#add-class-from-activex-control-wizard).
28
26
29
27
In the wizard, you can add more than one interface in an ActiveX control. You can also create classes from more than one ActiveX control in a single wizard session.
30
28
@@ -40,56 +38,40 @@ The wizard creates an MFC class, derived from [CWnd](../mfc/reference/cwnd-class
40
38
41
39
Use this wizard to add an MFC class from an available ActiveX control. The wizard creates a class for each interface you add from the selected ActiveX control.
42
40
43
-
-**Add Class From**
41
+
:::image type="content" source="../ide/media/add-mfc-class-from-activex-control.png" alt-text="Add class from ActiveX control wizard":::
42
+
43
+
-**Implement interface from**
44
44
45
45
Specifies the location of the type library from which the class is created.
46
46
47
47
|Option|Description|
48
48
|------------|-----------------|
49
-
|**Registry**|The type library is registered in the system. Registered type libraries are listed in **Available ActiveX controls**.|
49
+
|**Registry**|The type library is registered in the system. Registered type libraries are listed in **Available type libraries**.|
50
50
|**File**|The type library isn't necessarily registered in the system but is stored in a file. Provide the file location in **Location**.|
51
51
52
-
-**Available ActiveX controls**
52
+
-**Available type libraries**
53
53
54
-
Specifies the ActiveX controls currently registered in the system. Select an ActiveX control from this list to display its interfaces in the **Interfaces** list. See [MFC ActiveX controls: Distributing ActiveX controls](../mfc/mfc-activex-controls-distributing-activex-controls.md) for more information about registering ActiveX controls.
54
+
Specifies the ActiveX controls currently registered in the system. Select an ActiveX control from this list to display its interfaces in the **Interfaces** list. For more information about registering ActiveX controls, see [MFC ActiveX controls: Distributing ActiveX controls](../mfc/mfc-activex-controls-distributing-activex-controls.md).
55
55
56
-
If you select **File** under **Add Class From**, this box is unavailable for change.
56
+
If you select **File** under **Implement interface from**, this box is unavailable for change.
57
57
58
58
-**Location**
59
59
60
-
Specifies the location of the ActiveX control. If you select **File** under **Add Class From**, you can provide the location of the file that has the type library. To browse to the location of the file, select the ellipsis button.
60
+
Specifies the location of the ActiveX control. If you select **File** under **Implement interface from**, you can provide the location of the file that has the type library. To browse to the location of the file, select the ellipsis button.
61
61
62
-
If you select **Registry** under **Add Class From**, this box is unavailable for change.
62
+
If you select **Registry** under **Implement interface from**, this box is unavailable for change.
63
63
64
-
-**Interfaces**
64
+
-**Available Interfaces**
65
65
66
-
Specifies the interfaces in the ActiveX control. The wizard uses the interfaces from the current selection in **Available ActiveX controls**, or it uses the interfaces from the type library file specified in **Location**.
66
+
Specifies the interfaces in the ActiveX control. The wizard uses the interfaces from the current selection in **Available type libraries**, or it uses the interfaces from the type library file specified in **Location**.
67
67
68
68
|Transfer button|Description|
69
69
|---------------------|-----------------|
70
-
|**>**|Adds the interface currently selected in the **Interfaces** list. Unavailable if no interface is selected.|
71
-
|**>>**|Adds all the interfaces in the ActiveX control. The wizard uses the interfaces from the current selection in **Available ActiveX controls**, or it uses the interfaces from the type library file specified in **Location**.|
72
-
|**\<**|Removes the class currently selected in the **Generated classes** list. Unavailable if no class is currently selected in the **Generated classes** list.|
73
-
|**\<\<**|Removes all the classes in the **Generated classes** list. Unavailable if the **Generated classes** list is empty.|
74
-
75
-
-**Generated classes**
76
-
77
-
Specifies the class names to be generated from the interfaces added using the **>** or **>>** button. You can select this box to select a class, and then use the up or down keys to scroll through the list. When you select **Finish**, you may view each generated class name in the **Class** box and each generated file name in the **.h file** box. You can select only one class at a time in this box.
78
-
79
-
You can remove a class by selecting it in this list and selecting **<**. You don't need to select a class in the **Generated classes** box to remove all classes. By selecting **<<**, you remove all classes in the **Generated classes** box.
80
-
81
-
-**Class**
82
-
83
-
Specifies the name of the class selected in the **Generated classes** box that the wizard adds when you select **Finish**. You can edit the name in the **Class** box.
84
-
85
-
-**.h file**
86
-
87
-
Sets the name of the header file for the new object's class. By default, this name is based on the name you provide in **Generated classes**. Select the ellipsis button to save the file name to the location of your choice, or to append the class declaration to an existing file. If you choose an existing file, the wizard won't save it to the selected location until you select **Finish** in the wizard.
88
-
89
-
The wizard doesn't overwrite a file. If you select the name of an existing file and then select **Finish**, the wizard prompts you to indicate whether to append the class declaration to the file contents. Select **Yes** to append the file; select **No** to return to the wizard and specify another file name.
90
-
91
-
-**.cpp file**
70
+
|**>**|Adds the interface currently selected in the **Available Interfaces** list. Unavailable if no interface is selected.|
71
+
|**>>**|Adds all the interfaces in the ActiveX control. The wizard uses the interfaces from the current selection in **Available type libraries**, or it uses the interfaces from the type library file specified in **Location**.|
72
+
|**\<**|Removes the class currently selected in the **Implement interfaces** list. Unavailable if no class is currently selected in the **Implement interfaces** list.|
73
+
|**\<\<**|Removes all the classes in the **Implement interfaces** list. Unavailable if the **Implement interfaces** list is empty.|
92
74
93
-
Sets the name of the implementation file for the new object's class. By default, this name is based on the name you provide in **Generated classes**. Select the ellipsis button to save the file name to the location of your choice. The file isn't saved to the selected location until you select **Finish** in the wizard.
75
+
-**Implement interfaces**
94
76
95
-
The wizard doesn't overwrite a file. If you select the name of an existing file and then select **Finish**, the wizard prompts you to indicate whether to append the class implementation to the file contents. Select **Yes** to append the file; select **No**to return to the wizard and specify another file name.
77
+
Specifies the class names to be generated from the interfaces added using the **>** or **>>** button. You can select this box to select a class, and then use the up or down arrow keys to scroll through the list.
0 commit comments