Pack OCX and DLL files into a cab file to enable Internet Explorer Installation

Source: Internet
Author: User
Tags constant definition
Basic knowledge

OBJECT tags in HTML
Definition and usage
Defines an embedded object. Use this element to add multimedia to your XHTML page. This element allows you to specify the data and parameters for inserting objects in the HTML document, as well as for displaying and operating data.Code. <Object> tags are used to include objects, such as images, audios, videos, Java applets, ActiveX, PDF, and Flash. The original intention of the object is to replace the IMG and Applet elements. However, this is not implemented due to vulnerabilities and lack of browser support. The support for browser objects depends on the object type. Unfortunately, mainstream browsers use different codes to load the same object type. Fortunately, the object provides a solution. If the object element is not displayed, the code between <Object> and </Object> is executed. In this way, we can nest Multiple object elements (each corresponding to a browser ).

Instance
Add an object to HTML:

View plaincopy to clipboardprint? <Object classid = "CLSID: f08DF954-8592-11D1-B16A-00C0F0283628 "id =" slider1 "width =" 100 "Height =" 50 "> <Param name =" borderstyle "value =" 1 "/> <Param name =" mousepointer "Value = "0"/> <Param name = "enabled" value = "1"/> <Param name = "min" value = "0"/> <Param name = "Max "value =" 10 "/> </Object> <object classid =" CLSID: f08DF954-8592-11D1-B16A-00C0F0283628 "id =" slider1"
Width = "100" Height = "50">
<Param name = "borderstyle" value = "1"/>
<Param name = "mousepointer" value = "0"/>
<Param name = "enabled" value = "1"/>
<Param name = "min" value = "0"/>
<Param name = "Max" value = "10"/>
</Object> reference

Http://www.w3school.com.cn/tags/tag_object.asp

Registration class ID: CLSID in Windows
The universal unique identifier (UUID) used to identify the COM component. Each COM component has its own CLSID in the Windows registry, so that other applications canProgramLoad.

Obtain ActiveX Control CLSID
After compilation and completion of each activexcontrol, the system will generate an ocx.html file, which is the method to call the ActiveX control. There is an object tag in the page, and one line records the CLSID of the ocx file, as shown below:

View plaincopy to clipboardprint? <Object ID = "toposceneviewer" width = 800 Height = 600 classid = "CLSID: 321b84c8-3745-4ac9-bf04-55753f40ce63"> </Object> <object
Id = "toposceneviewer"
Width = 800
Height = 600
Classid = "CLSID: 321b84c8-3745-4ac9-bf04-55753f40ce63">
</Object>
--------------------------------------------------------------------------------

Create a cab file
The cab file must contain a series of files. The. inf file tells ie how to install these files. How do we write inf from the. inf file?
The inf file consists of three parts: Section, key, and value. The key section contains the [version] version description, which is mainly used for version control. [Strings] string information for constant definition. [Destinationdirs] defines the system path information. [Sourcedisksnames] indicates the source disk information. [Sourcedisksnames] indicates the name of the source disk. [Defainstall install. [Version] version description, mainly used for version control.
[Strings] string information for constant definition.
[Destinationdirs] defines the system path information.
[Sourcedisksnames] indicates the source disk information.
[Sourcedisksnames] indicates the name of the source disk.
[Defainstall install. Other sections can be customized.

Generally, it is in the [version] area at the beginning:

[Version] Signature = "$ XXXX $" advancedinf = 2.0 [version]
Signature = "$ XXXX $"
The advancedinf = 2.0 "signature" item defines the operating system version in which the INF file needs to run. There are $ Windows NT $, $ Chicago $, or $ Windows 95 $ values to choose from. Generally, choose $ Chicago $.

Next is the most important [Add. Code] area:

[Add. Code] ctrl1.dll = c1section ctrl2.dll = ctrl2.dll [Add. Code]
Ctrl1.dll = c1section
Ctrl2.dll = ctrl2.dll is the name of the file to be downloaded, followed by the region name corresponding to the file, which can be any name, but it is generally the same as the file name, so it is easy to maintain.

Note that files in the [Add. Code] area should be sorted by dependencies. For example, if ctrl1.dll is dependent on ctrl2.dll, ctrl2.dll must appear before ctrl1.dll. Because the installation is performed in the opposite order, that is to say, you must first install ctrl2.dll, then ctrl1.dll and zookeeper. Remember clearly and do not reverse it.

Next is the area of each file.

[Ctrl1.dll] file-win32-x86 = thiscab registerserver = Yes CLSID = {...} destdir = fileversion =, [ctrl1.dll]
File-win32-x86 = thiscab
Registerserver = Yes
CLSID = {.....}
Destdir =
The first file value in the fileversion =, [ctrl1.dll] area tells ie where to get the DLL. The file consists of three parts, the first part is file, this is always the case (at least for the moment); the second part tells the declared supported OS that Win32 indicates windows, Mac is the Apple Mac ox, and the third part is the CPU type, for example, x86, PPC (Power PC), MIPS, or alpha.

The file value can be set to three URLs, ignore, and thiscab. If it is a URL, it indicates the location of the URL. If it is ignore, it indicates the OS and CPU, you do not need to download this file (ctrl1.dll); if it is thiscab, it is obviously in the current cab file.

The following is the registerserver. You can take two values: Yes and no. If yes, it indicates that IE wants to register the DLL. If no, it is unnecessary. + If yes is selected, you must specify the CLSID. Otherwise, a row of CLSID can be omitted. +

The next step is destdir, whose value is the location where the DLL will be saved to the local hard disk. If its value is 10, place the DLL under \ windows or \ WINNT; if it is 11, put it in \ WINDOWS \ SYSTEM or \ winnt \ system32; if it is empty (that is, there is no value), it will be placed in the \ windows or \ WINNT Downloaded Program Files directory;

The last is fileversion, which is more obvious. It illustrates the version number of ctrl1.dll.

For more information, see references.

Create a cab file
If you need to create a cab file, you first need cabarc or makecab, they will be available with the installation of the Cabinet SDK, the Cabinet SDK is a http://msdn.microsoft.com/workshop/management/cab/cabdl.asp
Cabarc can create, view, or work out files in the cab, while makecab can only be used to create the cab file.
When creating a cab file, you must include all the relevant files. You can use depends (included in VC) to check the required files. Use the INF file to write these items.
INF method: The inf file describes all OCX and DLL files in the cab. inf provides the required information through some naming regions.

Cabarc n ctrl1.cab ctrl1.inf ctrl1.dll cabarc n ctrl1.cab ctrl1.inf ctrl1.dll n indicates creating a new file. ctrl1.cab indicates the name of the file to be created, ctrl1.inf indicates the file to be added to the cab, wildcard characters can be used.
Then you can put the cab file on the webpage.
Reference
How to Write inf: http://www.cnblogs.com/sbdx/archive/2006/12/14/whatisinffile.html
How to Write cab-related inf: http://docs.google.com/Doc? Docid = 0aehzv88zbfy_zgdncgdqczzfmjixzhnnzdhtyzg & HL = zh_cn

--------------------------------------------------------------------------------

Signature

Apply for Certificate
You can search for the makecert tool in the vs2005 directory.

Run

Makecert-SK mynewkey-r-n "cn = issuing authority name, ou = certification, O = company name, E = name@email.com"-SS my mynew. CER cert2spc mynew. CER mynew. SPC makecert-SK mynewkey-r-n "cn = Name of the issuing authority, ou = certification, O = company name, E = name@email.com"-SS my mynew. CER
Cert2spc mynew. Cer mynew. SPC makecert ((makmak( makecert.exe)

Signature

To use the signtool tool, you can also find it in the vs2005 directory.

The signtool has multiple usage modes. The wizard mode with UI is used below.
Run

After signtool signwizard, enter signcodewizard:

Step1. select the cab file to be signed. step2. custom step3. select mynew from the file. private Key/key container in SPC step4.csp: mynewkey step5.sha1 step6.next step7. Description: plug-in name/Web: www.yourcompany.com step8.http: // timestamp.verisign.com/scripts/timstamp.dll step1.
Step2. custom
Step3. select mynew. SPC from the file
Private Key/key container in step 4.csp: mynewkey
Step5.sha1
Step6.next
Step7. Description: plug-in name/Web: www.yourcompany.com
Step 8.http: // timestamp.verisign.com/scripts/timstamp.dll signtool for Detailed Help, refer to the signature tool (signtool.exe)

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/wangjingfei/archive/2010/03/25/5417028.aspx

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.