The ActiveX control is packaged as a cab to be automatically downloaded and installed in the Web page (GO)

Source: Internet
Author: User

[background] friends who have done ActiveX control know that to put their own ActiveX control functions on their own web pages, then the user must register locally on the client, that is to say, the user has to first put the ActiveX control (test.ocx) Put it under the%system%/system32 of this machine and run the DOS tool inside to run the regsvr32 test.ocx command to register. But if you do, it means you're in danger, because you're going to have to deploy the settings environment to achieve your goals, and you lose the value of the software project itself. So what should we do to deal with this situation? Smart you will soon think that we can enable users to automatically download the ActiveX control on the client, so that we can achieve the functionality we want, and do not need the user to deploy settings environment, this is not double benefit. [Prerequisites] a toolset for packaging and data authentication of ActiveX controls: Makecert.exe makes a certificate in CER format, which is the certificate of the first, and can also create a private key and a public key. Cert2spc.exe converts a CER format certificate into an SPC-format certificate, the PKCS #7证书. Cabarc.exe the OCX into a cab. Signcode.exe signed the certificate to the OCX. Chktrust.exe Check if the OCX is correct after signing the certificate. Certmgr.exe is used for management certificates. The OCX control evs1300.ocx is used for packaging. The tool actvxdoc for viewing the OCX control. [production process] , environment settings 1, download the MakeCab package, extract to a local directory (such as the e-packing directory), such as viewing to 1 of the toolset shown, the download was successful:

2, set the system environment variables, right-click on "My Computer" à select "Properties" à select the "Advanced" tab, open the System Properties panel shown in 2:

3. Click the environment variables (N) button in the System Properties sectionto open Figure 3:

4, select "System variable (S)" In the "New (W)" button, open the "Edit System Variables" dialog box, 4, and then in "Variable Value (V)" added; E/makecab ":

Second, put the OCX control for packaging in the e-packing directory (this document is described using a control named Evs1300.ocx), 5, where Evs1300.ocx is the control object that this document operates on, and Mfc71.dll, Msvcp71.dll, MSVCR71.dll These three files are usually packaged as packaged files, but not mandatory (packaged together), which can be found in the system's System32 directory, please prepare yourself.

Third, the ActiveX release steps

1. Click "Start" à "move line (R)" à input "cmd" à enter into the directory where the control of the operation is located, as shown in 6:

2. Create the pvk file (private key file), enter "Makecert-sk evS1300 evs1300.pvk-n cn=xxxxxxx Company" on the command line, then enter, 7:

3. Create a CER file (company certificate), enter "Makecert-sk evs1300.pvk evs1300.cer" on the command line, then enter, 8, if the "successed" prompt appears, the e:/ The evS1300 directory generates the Evs1300.cer file, as shown in 9:

4, create the SPC test software publisher certificate, enter "CERT2SPC evs1300.cer evs1300.spc" in the command line, and then enter, 10 shows:

5. Create an INF file and edit the following information in the notebook

    1. [Version]
    2. Signature= "$CHINA $"
    3. advancedinf=1.0
    4. [Add.Code]
    5. Evs1300.ocx=evs1300.ocx
    6. Msvcr71.dll=msvcr71.dll
    7. Mfc71.dll=mfc71.dll
    8. Msvcp71.dll=msvcp71.dll
    9. [Evs1300.ocx]
    10. File=thiscab
    11. CLSID={0440906E-9BD6-4F3E-B65A-39E1B339D9DA}
    12. fileversion=1,0,0,0
    13. Registerserver=yes
    14. [MSVCR71.dll]
    15. File-win32-x86=thiscab
    16. Registerserver=no
    17. destdir=11
    18. fileversion=7,10,3052,4
    19. [Mfc71.dll]
    20. File-win32-x86=thiscab
    21. Registerserver=no
    22. destdir=11
    23. fileversion=7,10,3077,0
    24. [Msvcp71.dll]
    25. File-win32-x86=thiscab
    26. Registerserver=no
    27. destdir=11
    28. fileversion=7,10,3077,0

In Evs1300.inf's content, [version] and [Add.Code] entries are required, [Add.Code] The number of key-value entries depends on how much of the items you have prepared. [MSVCR71.dll], [Mfc71.dll], [Msvcp71.dll] is what I said above is not necessary, as long as you want to MSVCR71.dll, Mfc71.dll, Msvcp71.dll included in the release package, so that three items must be written in the INF, and the specific contents of these three items are fixed, can be copied in the past. The key is the [Evs1300.ocx] item, where the CLSID and FileVersion are Evs1300.ocx ClassID and version, which requires one to no, we publish the CAB package when the client automatically updates the download installation. Speaking of which, how do we know the ClassID and version in Evs1300.ocx? I described in the prerequisites above that there is a tool for viewing the OCX control Actvxdoc, yes, it is, we double-click the file to run it, you can see the interface shown in Figure 13:

In the interface of Figure 13, click "File" à "open ..." to open the OCX control you want to view, as shown in 14:

With the controls open, we can see the fileversion and classid,15 we want to look at in the drop-down box in the "Class" on the right side of the interface:

6. Create a CAB file, enter "Cabarc-s 6144 n evs1300.cab msvcr71.dll mfc71.dll msvcp71.dll evs1300.ocx evs1300.inf" on the command line, and then enter, 16 as shown:

7, using the Code Signing Wizard to sign a CAB file, first double-click on the Run tool set inside the Signcode.exe (or directly enter "Signcode" in the command line), the system will pop up 17 shows the Digital Signature wizard:

8, click the "Next (N)" button, as shown in Figure 18, select the file Evs1300.cab file to be digitally signed and made into a cab package.

9. After selecting the CAB package, click the "Next (N)" button, select "Custom (C)" In the desired signature type and click "Next (N)" button, 19:

10. Next click the "Select from File (F)" button and select the evs1300.cer,20 that you just made:

11. Click the "Next (N)" button in Figure 20 to figure 21, then select "Private key (K) in CSP" in Figure 21.

12. Click the next (N) button in Figure 21, then select "Shal" in the hashing algorithm in Figure 22 and click the "Next (N)" button.

13. In Certificates in Certificate path, select all certificates in the certification path, including root certificate (C), select the Include certificates in the following PKCS #7 certificate (. p7b) file (P): "In other certificates (optional), and click Browse (R) ..." button to select the Evs1300.spc file, click the "Next (N)" button when you are finished, and 23:

14. Next, enter the company name and URL in the "Data description" window that pops up and click on the "Next (N)" button, 24:

15, most of the work has been completed, in the next step is an optional operation, its role is only to add a timestamp to the cab, this step can completely do not do, 25 shows:

(Here I mention arch three free code signature timestamp address)

Verisign:http://timestamp.verisign.com/scripts/timstamp.dll

Comodo:http://timestamp.comodoca.com/authenticode

Geotrust/trustcenter:http://www.trustcenter.de/codesigning/timestamp

16, complete, in Figure 25 click the "Next (N)" button will come to the Digital Signature Wizard The last step, that is, the operation overview, 26, click the "Finish" button can be completed, 27 is shown:

Http://www.cnblogs.com/lidabo/archive/2012/12/04/2800925.html

The ActiveX control is packaged as a cab to be automatically downloaded and installed in the Web page (GO)

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.