Configure ActiveX controls to download and install them on the webpage

Source: Internet
Author: User

I remember I have reposted an article about C # developing ActiveX Controls: Using C # To develop ActiveX controls (zt). Recently I found that ActiveX controls cannot be automatically downloaded during project use, this requires manual registration for the client using ActiveX, which is obviously not suitable.

In principle, we should first check whether the ActiveX control is installed in the client browser. If ActiveX is not installed, We need to prompt the browser to download and allow installation. Otherwise, the ActiveX control is used directly. We can use codebase to meet our requirements: The following is an HTML call:

<Object classid = "CLSID: 636b8ce1-7512-464c-b63c-fc75bdca21db" codebase = "charles2008activex/setup.exe # version = 200," width = "" Height = "40"> </Object>

 

Note that the codebase attribute specifies the path of the Installation File: charles2008activex/setup.exe, and the version is 1.0.0.0. This is relative, and the final statement on this page is the setup.exe file in the charles2008activexfolder under the current URL. This file is the ActiveX Installation File.

In this way, we can use the codebase attribute to meet our ActiveX control requirements.

In this case, we need to explain another problem: how can we generate the. exe file or. cab file for the activexcontroller?

You can create an installer for the developed ActiveX control. Assume that the ActiveX control is developed by C. The packaging process is actually the same as that of a normal winform program. Note that you need to set the following url: (for example)

Set http: // 192.168.1.101/ActiveX. This directory must exist to store the generated installation file for the client to download and install.

After the configuration is complete, two files will be generated for the generation project, one. EXE file and one. MSI file. Copy the generated EXE and MSI files to the ActiveX directory of the website.

When the website is started, ensure that the directory of setup.exe is consistent with the [installation url] in [installation project. Generally, a prompt is displayed, indicating whether to install ActiveX controls. If you do not install ActiveX controls, add the website to a trusted site and allow downloading insecure and unsigned controls. If you install the software in this way, the software installation interface is displayed on the client. Similar to winform installation.

We can also package the program to generate a cab file, that is, package the. MSI file generated above to generate a cab file. There are many helper tools such as cabarc.exe. For usage, refer to other network resources. It is said that it is convenient and easy to use. This is not detailed here!

In short, we can package ActiveX to generate the installation program we want and use codebase to specify the URL for downloading ActiveX controls to meet the requirements:

After the ActiveX control is installed on the client, you do not need to install it again. If the ActiveX control is not installed, you can download and install it from the codebase path, which also meets the control requirements of the client.

Best regards,

Charles Chen

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.