Use WinRAR + JavaScript to solve ActiveX Automatic Installation Problems

Source: Internet
Author: User

First, correct one idea. The so-called automatic installation is not forced installation. Otherwise, it becomes a rogue software. Even if it is a well-known ActiveX such as Silverlight and flash, users have the right to choose to install or not to install it.

The more orthodox solution is to prompt the user to set ie permissions, add codebase = 'ocx download path' to the object, and then create a digital certificate. I personally think this is complicated.

My solution:

1. First Use js to check whether ActiveX is available

Code

  < Object ID = 'X' Name = 'X' Classid = 'Clsid: 82ab2103-26bc-4999-8dde-df1a647d96e5' > </ Object >

< Script Type = "Text/JavaScript" >
Try {
VaR X = Document. getelementbyid ( ' X ' );
If (X. Caption = Undefined ){
If (Confirm ( ' The required ActiveX plug-in is not installed on your machine! Need to be installed? ' )){
Window. Open ( ' Http://www.youname.com/setup.exe ' )
};
}
}
Catch (E ){
}
  </ Script >

Note: ActiveX developed by Delphi must have the caption attribute by default. If the caption attribute is undefined, the control is not installed. After asking the user, the system jumps to download the installation file. ActiveX developed by other tools can also be detected using similar methods.

 

2. Download the Installation File

The installation of ActiveX is to call the regsvr32 command to register OCX. Therefore, basically the installation is a copy & run process, which can be done with WinRAR.

WinRAR can package files into self-extracting files in EXE format, and execute some commands before or after decompression, or even start -->Program"Generate shortcuts. These are enough for us to build an installer.

(1)Write several batches for automatic registration or anti-registration and deletion.

Install. BAT reference content: (assume that the program is installed/decompressed to the C: \ capture directory)
Regsvr32 c: \ capture \ qqcaptureactivex. ocx-S

Uninstall. BAT reference content:
Regsvr32 c: \ capture \ qqcaptureactivex. ocx/u

Delete. BAT reference content:
Regsvr32 c: \ capture \ qqcaptureactivex. ocx/u-s

Del c: \ capture \ cameradll. dll

Del c: \ capture \ qqcaptureactivex. ocx

Del c: \ capture \ install. bat

Del c: \ capture \ Uninstall. bat

Del c: \ capture \ Delete. bat

Rd c: \ capture

(2)Start to use WinRAR to create the installation program

 

 

 

 

 

 

 

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.