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
The **Add IDL MFC Method** wizard adds a method to an interface defined in an Interface Definition Library (IDL) in a Microsoft Framework Class (MFC) project. To use the **Add IDL MFC Method** wizard you must be in an MFC Project, ActiveX project or an ATL project that supports MFC. For example, if you have a Microsoft ActiveX control project, and you open the IDL library, using following procedure you can add the method to interface. If the project contains a class associated with the interface, the wizard will add the method to the class, too.
12
+
The **Add IDL MFC Method** wizard adds a method to an Interface Definition Library (IDL) interface defined in your Microsoft Framework Class (MFC) project. If the project contains a class associated with the interface, the wizard also adds the method to the class.
13
13
14
-
This wizard differs from the [Add Method](../../ide/adding-a-method-visual-cpp.md) wizard (which adds a method to an IDL interface) in the following ways:
14
+
To use the this wizard, you must be in an MFC Project, ActiveX project, or an ATL project that supports MFC. For example, if you have a Microsoft ActiveX control project, you can use the following procedure to add a method to an IDL interface in the solution.
15
+
16
+
This wizard differs from the [Add Method](../../ide/adding-a-method-visual-cpp.md) wizard (which adds a method to an IDL interface) in the following ways:
15
17
16
18
- It's specific to MFC, ActiveX, or ATL projects that support MFC. For ATL projects that don't support MFC, only the **Add Method** wizard is available.
19
+
- It adds the following entries if a Dispatch map is found in the project:
17
20
18
-
- It adds the following entries if a Dispatch map is found in the project.
Set the name for the method. The following table describes the method name options depending on the kind of interface:
57
60
58
-
|Interface type|Description|
61
+
|Interface kind|Method name|
59
62
|--------------------|-----------------|
60
63
|ATL dual interface, custom interface, and local custom interface|Provide your own method name.|
61
-
|MFC dispinterface|Provide your own method name or select a suggested method name from the list. If you select a name from the list, the appropriate value appears in the **Return type**, and it can't be changed.|
62
-
|MFC ActiveX control dispinterface|Provide your own or select either of the stock methods [DoClick](../reference/colecontrol-class.md#doclick)and[Refresh](../reference/colecontrol-class.md#refresh). For more information, see [MFC ActiveX controls: Adding stock methods](../mfc-activex-controls-adding-stock-methods.md).|
64
+
|MFC dispinterface|Provide your own method name or select a suggested method name from the list. If you select a name from the list, the appropriate return type appears in **Return type**, and can't be changed.|
65
+
|MFC ActiveX control dispinterface|Provide your own method name or select one of the stock methods:[DoClick](../reference/colecontrol-class.md#doclick)or[Refresh](../reference/colecontrol-class.md#refresh). For more information about stock methods, see [MFC ActiveX controls: Adding stock methods](../mfc-activex-controls-adding-stock-methods.md).|
63
66
64
67
-**Internal name**
65
68
66
-
Only available for custom methods (if **Method type** is selected as custom) added to an MFC dispinterface. The name that will be used in the dispatch map, the header (.h) file, and the implementation (.cpp) file. By default, this name is the same as **Method name**.
69
+
Only available when **Method type** is **custom**. This is the name that will be used in the dispatch map, the header (.h) file, and the implementation (.cpp) file. By default, this name is the same as **Method name**. It is added to the MFC dispinterface.
67
70
68
-
You can change the method name according to the following table if you are adding the method to an MFC dispinterface or MFC ActiveX control dispinterface.
71
+
If you're adding the method to an MFC or MFC ActiveX control dispinterface, you can change the method name as described by the following table:
69
72
70
-
|Interface type|Description|
73
+
|Interface type|Internal name|
71
74
|--------------------|-----------------|
72
75
|ATL dual interface, custom interface, and local custom interface|Not available.|
73
76
|MFC dispinterface|Set to the method name by default. You can edit the internal name.|
74
77
|MFC ActiveX control dispinterface|You can set the internal name only for custom methods. Stock methods don't use an internal name.|
75
78
76
79
-**Return type**
77
80
78
-
The data type returned by the method. The standard way to return error codes from methods defined in an interface is with a `HRESULT`.
81
+
The data type returned by the method. The standard return type for interface methods is `HRESULT`.
82
+
83
+
If the interface is a dual interface or a custom interface, only the `HRESULT` return type is allowed.
79
84
80
-
If the interface type is dual interface or custom interface, only `HRESULT` return type is allowed. You can set the data type according to the interface type, as defined in the following table:
85
+
You can set the data type according to the kind of interface the method is being added to, as described in the following table:
81
86
82
-
|Interface type|Description|
87
+
|Interface kind|Return type|
83
88
|--------------------|-----------------|
84
89
|Dual interface|`HRESULT`. Unchangeable.|
85
90
|Custom interface|`HRESULT`. Unchangeable.|
86
-
|Local custom interface|Provide your own return type or select from the list.|
87
-
|Dispinterface|Provide your own return type or select from the list.|
88
-
|MFC ActiveX control dispinterface|If you implement a stock method, the return type is set to the appropriate value and is unchangeable. If you select a method from the **Method name** list and select **Custom** under **Select method type**, select a return type from the list.|
91
+
|Local custom interface|Provide your own return type or select one from the list.|
92
+
|Dispinterface|Provide your own return type or select one from the list.|
93
+
|MFC ActiveX control dispinterface|If you implement a stock method, the return type is set to the appropriate value and is unchangeable. If you select a method from the **Method name** list, and select **Custom** under **Select method type**, select a return type from the list.|
89
94
90
95
-**Method type**
91
96
92
-
Available only for MFC ActiveX controls. Unavailable if you provide a method name in **Method name** rather than selecting a method from the list.
97
+
Available only for MFC ActiveX controls. Unavailable if you provided a method name in **Method name** rather than selecting a method from the list.
93
98
94
-
If you select one of the methods in the **Method name** list, select either the stock implementation or a custom implementation.
99
+
If you select one of the methods in the **Method name** list, in the **Method type** drop-down select either the **Stock** or **Custom**implementation. This affects the return type and method implementation that the wizard provides, as described in the following table:
95
100
96
101
|Method type|Description|
97
102
|-----------------|-----------------|
98
-
|**Stock**|The default. Inserts the default implementation of the method you select in the **Method name** list. **Return type** is unchangeable if you select **Stock**.|
99
-
|**Custom**|You provide a custom implementation for the method selected in **Method name**. You can provide your own return type, or select one from the **Return type** list|
103
+
|**Stock**|The default. Inserts the default implementation of the method selected in the **Method name** list. **Return type** is unchangeable if you select **Stock**.|
104
+
|**Custom**|You provide a custom implementation for the method selected in **Method name**. You can provide your own return type or select one from the **Return type** list.|
100
105
101
106
-**Parameters**
102
107
@@ -106,7 +111,7 @@ The following section describes the UI that you'll use to add a method:
106
111
107
112
Add a parameter. In **Parameters**, type the parameter type, name, and any modifiers. For example, `int x`, and choose **OK**.
108
113
109
-
If you don't provide a parameter name, the wizard ignores any parameter attributes (ATL only) or **Parameter type** selections.
114
+
If you don't provide a parameter name, the wizard ignores any **Parameter type** selections; and for ATL projects, the parameter attributes are also ignored.
110
115
111
116
-**x**
112
117
@@ -116,22 +121,23 @@ The following section describes the UI that you'll use to add a method:
116
121
117
122
Edit the selected parameter.
118
123
119
-
-`id`
124
+
-**`id`**
120
125
121
-
Sets the numeric ID that identifies the method. For more information, see [id](/windows/win32/Midl/id) in the *MIDL Reference*.
126
+
Sets the numeric ID that identifies the method. For more information, see [id](/windows/win32/midl/id) in the [MIDL reference](/windows/win32/midl/midl-language-reference.md).
122
127
123
-
-`call_as`
128
+
-**`call_as`**
124
129
125
-
Specifies the name of the remote method to map to this local method. For more information, see [call_as](/windows/win32/Midl/call-as) in the *MIDL Reference*.
130
+
Specifies the name of the remote method to map to this local method. For more information, see [call_as](/windows/win32/midl/call-as) in the [MIDL reference](/windows/win32/midl/midl-language-reference.md).
126
131
127
-
-`helpcontext`
132
+
-**`helpcontext`**
128
133
129
-
Specifies a context ID that lets the user view information about this method in the Help file. For more information, see [helpcontext](/windows/win32/Midl/helpcontext) in the *MIDL Reference*.
134
+
Specifies a context ID that lets the user view information about this method in the Help file. For more information, see [helpcontext](/windows/win32/Midl/helpcontext) in the [MIDL reference](/windows/win32/midl/midl-language-reference.md).
130
135
131
-
-`helpstring`
136
+
-**`helpstring`**
132
137
133
-
Specifies a text that describes the associated element. By default its *Method name*. For more information, see [helpstring](/windows/win32/Midl/helpstring) in the *MIDL Reference*.
138
+
Specifies a text that describes the associated element. By default its *Method name*. For more information, see [helpstring](/windows/win32/Midl/helpstring) in the [MIDL reference](/windows/win32/midl/midl-language-reference.md).
0 commit comments