C # Implementing ActiveX Control Development and deployment

Source: Internet
Author: User

Now, we have this control package in hand: Qrcode.cab, let's write a test page


Codebase= "qrcode.cab#version=1,0,0,0" indicates the location and version of the reference control package (for the upgrade of the control, which is discussed later)

Classid= "clsid:2865d2a6-9bce-4522-9f39-eddb2887375d" is the GUID of the control before we write the control

So that we can test it locally or on the Publish to IIS.

If you do not want to adjust IE security settings at 1.1, you can set the site as a trusted site directly, and lower the security level, due to issues such as signing and so on that may indicate security restrictions or inability to install.

Then open the browser, prompting the control to install, click "Install"

This allows the control to deploy the installation, and it can be invoked with JS.

But what if we need to upgrade our controls later? If you use the method described above to deploy a control, you need to follow these steps to upgrade your work:

1. Update the version of ActiveX:

(1) Right-click on the ActiveX project, properties, application, assembly information, the original version is, modified to

(2) Regenerate.
2, modify the installation program

(1) Adding a registry key

Right-click on the item, view, registry:

Create the guid}/installedversion/of Clsid/{activex under HKEY_CLASSES_ROOT,

Under Installedversion, create a new string value, modify the value of the string to "1,0,1,0″,

Note: Deleting the value in the name automatically displays the (default) so that you can set the default value in the registry and do not enter default values yourself.

(2) Modify the installer version

Modify version to "1.0.1″, modify RemovePreviousVersions to" True ".

(3) Rebuild the installer

3. Re-create the CAB installation package

4. Modify the website code

(1) Replace the resulting CAB installation package with the original installation package.

(2) Modify the page control version

<object id= "Qrcodeocx" codebase= "qrcode.cab#version=1,0,1,0" classid= "clsid : 2865d2a6-9bce-4522-9f39-eddb2887375d "></object>

The next time the browser refreshes, it will compare this version and upgrade accordingly. The upgrade here actually involves two parts of the upgrade, one part is the upgrade of the cab, the other part is the MSI upgrade, so here to understand the concept of two sets of upgrade comparison-update the CAB version and registry version:

Let's start with the cab version.
The version of the CAB (that is, the codebase version in HTML) is registry with the client.
That is to say, we need to write this registry in the client when we install MSI.
Here's how:
In the ActiveX Setup Setup, right-click –> View –> Registry add

After the build, the Regisry will be written to the client's machine when the MSI is installed.
(Please note, [ComRegisterFunction ()] This method is not possible, because the installation of MSI will not execute)

For example
Please replace the following GUID with the GUID of the ActiveX control, and please keep {} in registry.
registry:hkcr/clsid/{guid}/installedversion/(Default) = "1,2,0,0″
Html:classid= "Clsid:guid" codebase= "Yourproduct.cab#version=1,2,0,0″

This way, when you browse your Web page, the codebase version of HTML and the version of Registry will be set up, such as the version of HTML Registry version, will download and execute the CAB file.

The second point is the MSI version
ActiveX Setup Item –> Property –> version
This version is newer than the client version, or it will fail to install when the MSI is executed.
Also, to set the Remove previous version to True

Here are the purposes of these two settings:
1. HTML will be in line with the registry version of the client, and the version of the HTML can be downloaded when the version of the client is new, the CAB
2. When the cab is downloaded, the MSI or bat file will be executed under the INF, and when the MSI is executed, it'll be on its own with the MSI version of the last installation, and this time the version will continue to install

So both of them must be updated
In a word, if you don't write registry,html, the pair will become the version of the. NET Framework, and that's 2,0,50727, and for the time being, I don't know why.

Matching of Cab and registry

Add Registry in MSI
http://stackoverflow.com/questions/1506858/ How-to-get-com-server-for-excel-written-in-vb-net-installed-and-registered-in-aut

C # Implementing ActiveX Control Development and deployment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.