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
|**CTL_E_CANTSAVEFILETOTEMP**|Can't save file to TEMP|
134
-
|**CTL_E_SEARCHTEXTNOTFOUND**|Search text not found|
135
-
|**CTL_E_REPLACEMENTSTOOLONG**|Replacements too long|
136
-
137
-
If necessary, use the **CUSTOM_CTL_SCODE** macro to define a custom error code for a condition that is not covered by one of the standard codes. The parameter for this macro should be an integer between 1000 and 32767, inclusive. For example:
96
+
|CTL_E_ILLEGALFUNCTIONCALL|Illegal function call|
97
+
|CTL_E_OVERFLOW|Overflow|
98
+
|CTL_E_OUTOFMEMORY|Out of memory|
99
+
|CTL_E_DIVISIONBYZERO|Division by zero|
100
+
|CTL_E_OUTOFSTRINGSPACE|Out of string space|
101
+
|CTL_E_OUTOFSTACKSPACE|Out of stack space|
102
+
|CTL_E_BADFILENAMEORNUMBER|Bad file name or number|
|CTL_E_CANTSAVEFILETOTEMP|Can't save file to TEMP|
134
+
|CTL_E_SEARCHTEXTNOTFOUND|Search text not found|
135
+
|CTL_E_REPLACEMENTSTOOLONG|Replacements too long|
136
+
137
+
If necessary, use the CUSTOM_CTL_SCODE macro to define a custom error code for a condition that is not covered by one of the standard codes. The parameter for this macro should be an integer between 1000 and 32767, inclusive. For example:
@@ -158,7 +158,7 @@ This article covers advanced topics related to developing ActiveX controls. Thes
158
158
159
159
-or-
160
160
161
-
- Declare a local variable and subclass as the dialog item. Insert code that resembles the following (`CMyCtrl` is the wrapper class, `IDC_MYCTRL1` is the control's ID):
161
+
- Declare a local variable and subclass as the dialog item. Insert code that resembles the following (`CMyCtrl` is the wrapper class, IDC_MYCTRL1 is the control's ID):
Copy file name to clipboardExpand all lines: docs/mfc/mfc-activex-controls-distributing-activex-controls.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ This article discusses several issues related to redistributing ActiveX controls
30
30
The setup program you provide with your ActiveX controls should create a special subdirectory of the Windows directory and install the controls' .OCX files in it.
31
31
32
32
> [!NOTE]
33
-
> Use the Windows **GetWindowsDirectory** API in your setup program to obtain the name of the Windows directory. You may want to derive the subdirectory name from the name of your company or product.
33
+
> Use the Windows `GetWindowsDirectory` API in your setup program to obtain the name of the Windows directory. You may want to derive the subdirectory name from the name of your company or product.
34
34
35
35
The setup program must install the necessary redistributable DLL files in the Windows system directory. If any of the DLLs are already present on the user's machine, the setup program should compare their versions with the versions you are installing. Reinstall a file only if its version number is higher than the file already installed.
36
36
@@ -41,14 +41,14 @@ This article discusses several issues related to redistributing ActiveX controls
41
41
42
42
If you prefer, you can write your setup program to register the control directly instead.
43
43
44
-
Use the **LoadLibrary** Windows API to load the control DLL. Next, use **GetProcAddress** to obtain the address of the "DllRegisterServer" function. Finally, call the `DllRegisterServer` function. The following code sample demonstrates one possible method, where `hLib` stores the handle of the control library, and `lpDllEntryPoint` stores the address of the "DllRegisterServer" function.
44
+
Use the `LoadLibrary` Windows API to load the control DLL. Next, use `GetProcAddress` to obtain the address of the "DllRegisterServer" function. Finally, call the `DllRegisterServer` function. The following code sample demonstrates one possible method, where `hLib` stores the handle of the control library, and `lpDllEntryPoint` stores the address of the "DllRegisterServer" function.
The advantage of registering the control directly is that you do not need to invoke and load a separate process (namely, REGSVR32), reducing installation time. In addition, because registration is an internal process, the setup program can handle errors and unforeseen situations better than an external process can.
49
49
50
50
> [!NOTE]
51
-
> Before your setup program installs an ActiveX control, it should call **OleInitialize**. When your setup program is finished, call **OleUnitialize**. This ensures that the OLE system DLLs are in the proper state for registering an ActiveX control.
51
+
> Before your setup program installs an ActiveX control, it should call `OleInitialize`. When your setup program is finished, call `OleUnitialize`. This ensures that the OLE system DLLs are in the proper state for registering an ActiveX control.
Copy file name to clipboardExpand all lines: docs/mfc/mfc-activex-controls-licensing-an-activex-control.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ Licensing support, an optional feature of ActiveX controls, allows you to contro
28
28
ActiveX controls that implement licensing allow you, as the control developer, to determine how other people will use the ActiveX control. You provide the control purchaser with the control and .LIC file, with the agreement that the purchaser may distribute the control, but not the .LIC file, with an application that uses the control. This prevents users of that application from writing new applications that use the control, without first licensing the control from you.
29
29
30
30
## <aname="_core_overview_of_activex_control_licensing"></a> Overview of ActiveX Control Licensing
31
-
To provide licensing support for ActiveX controls, the [COleObjectFactory](../mfc/reference/coleobjectfactory-class.md) class provides an implementation for several functions in the **IClassFactory2** interface: **IClassFactory2::RequestLicKey**, **IClassFactory2::GetLicInfo**, and **IClassFactory2::CreateInstanceLic**. When the container application developer makes a request to create an instance of the control, a call to `GetLicInfo` is made to verify that the control .LIC file is present. If the control is licensed, an instance of the control can be created and placed in the container. After the developer has finished constructing the container application, another function call, this time to `RequestLicKey`, is made. This function returns a license key (a simple character string) to the container application. The returned key is then embedded in the application.
31
+
To provide licensing support for ActiveX controls, the [COleObjectFactory](../mfc/reference/coleobjectfactory-class.md) class provides an implementation for several functions in the `IClassFactory2` interface: `IClassFactory2::RequestLicKey`, `IClassFactory2::GetLicInfo`, and `IClassFactory2::CreateInstanceLic`. When the container application developer makes a request to create an instance of the control, a call to `GetLicInfo` is made to verify that the control .LIC file is present. If the control is licensed, an instance of the control can be created and placed in the container. After the developer has finished constructing the container application, another function call, this time to `RequestLicKey`, is made. This function returns a license key (a simple character string) to the container application. The returned key is then embedded in the application.
32
32
33
33
The figure below demonstrates the license verification of an ActiveX control that will be used during the development of a container application. As mentioned previously, the container application developer must have the proper .LIC file installed on the development machine to create an instance of the control.
34
34
@@ -63,15 +63,15 @@ Verification of a Licensed ActiveX Control During Execution
Verifies that the control allows design-time usage by checking the system for the presence of the control license file. This function is called by the framework as part of processing **IClassFactory2::GetLicInfo** and **IClassFactory::CreateInstanceLic**.
66
+
Verifies that the control allows design-time usage by checking the system for the presence of the control license file. This function is called by the framework as part of processing `IClassFactory2::GetLicInfo` and `IClassFactory::CreateInstanceLic`.
Requests a unique key from the control DLL. This key is embedded in the container application and used later, in conjunction with `VerifyLicenseKey`, to create an instance of the control. This function is called by the framework as part of processing **IClassFactory2::RequestLicKey**.
70
+
Requests a unique key from the control DLL. This key is embedded in the container application and used later, in conjunction with `VerifyLicenseKey`, to create an instance of the control. This function is called by the framework as part of processing `IClassFactory2::RequestLicKey`.
Verifies that the embedded key and the control's unique key are the same. This allows the container to create an instance of the control for its use. This function is called by the framework as part of processing **IClassFactory2::CreateInstanceLic** and can be overridden to provide customized verification of the license key. The default implementation performs a string comparison. For more information, see [Customizing the Licensing of an ActiveX Control](#_core_customizing_the_licensing_of_an_activex_control), later in this article.
74
+
Verifies that the embedded key and the control's unique key are the same. This allows the container to create an instance of the control for its use. This function is called by the framework as part of processing `IClassFactory2::CreateInstanceLic` and can be overridden to provide customized verification of the license key. The default implementation performs a string comparison. For more information, see [Customizing the Licensing of an ActiveX Control](#_core_customizing_the_licensing_of_an_activex_control), later in this article.
The ActiveX Control Wizard places the following code in the control header file. In this example, two member functions of `CSampleCtrl`'s object `factory` are declared, one that verifies the presence of the control .LIC file and another that retrieves the license key to be used in the application containing the control:
@@ -84,7 +84,7 @@ Verification of a Licensed ActiveX Control During Execution
> If you modify **szLicString** in any way, you must also modify the first line in the control .LIC file or licensing will not function properly.
87
+
> If you modify `szLicString` in any way, you must also modify the first line in the control .LIC file or licensing will not function properly.
88
88
89
89
The ActiveX Control Wizard places the following code in the control implementation file to define the control class' `VerifyUserLicense` and `GetLicenseKey` functions:
Copy file name to clipboardExpand all lines: docs/mfc/mfc-activex-controls-localizing-an-activex-control.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ This article discusses procedures for localizing ActiveX control interfaces.
26
26
> [!NOTE]
27
27
> This will not work correctly in some cases, if future instances have different locales.
28
28
29
-
- Use the **OnAmbientChanged** notification function to dynamically load the proper resources for the container's locale.
29
+
- Use the `OnAmbientChanged` notification function to dynamically load the proper resources for the container's locale.
30
30
31
31
> [!NOTE]
32
32
> This will work for the control, but the run-time DLL will not dynamically update its own resources when the ambient LocaleID property changes. In addition, run-time DLLs for ActiveX controls use the thread locale to determine the locale for its resources.
@@ -83,7 +83,7 @@ This article discusses procedures for localizing ActiveX control interfaces.
Place the code sample above into a member function of the control, such as an override of [COleControl::OnSetClientSite](../mfc/reference/colecontrol-class.md#onsetclientsite). In addition, `m_hResDLL` should be a member variable of the control class.
86
+
Place the code sample above into a member function of the control, such as an override of [COleControl::OnSetClientSite](../mfc/reference/colecontrol-class.md#onsetclientsite). In addition, *m_hResDLL* should be a member variable of the control class.
87
87
88
88
You can use similar logic for localizing a control's property page. To localize the property page, add code similar to the following sample to your property page's implementation file (in an override of [COlePropertyPage::OnSetPageSite](../mfc/reference/colepropertypage-class.md#onsetpagesite)):
0 commit comments