On the CAB compression of ActiveX control
Ningfenghua
This article briefly describes the cab compression and the steps to compress the ActiveX control into a CAB file using Wincab.
keywords ActiveX control; cab compression; Wincab;inf file
1. Introduction
ActiveX control technology is developed from OLE and expands OLE to fit the intern
The development of ET, Intranet, Commercial application program and so on. When the program code for an ActiveX control is transmitted over the Internet, it makes sense to use compression technology to transfer program code.
On the other hand, if the ActiveX control also calls to other DLL program modules, then IE must also download the programs locally. To do this, Microsoft uses the usual cab compression method that places the ActiveX control application and related other files in the same CAB file, and then specifies the URL path for the CAB file in the CodeBase property. When IE finds the CODEBASE attribute, it automatically resolves the URL address to extract the CAB file to the client's temp directory, then registers the file and invokes the COM API function to create the ActiveX control object. This completes the transfer of the ActiveX control.
2. A brief introduction of cab compression technology
When Microsoft releases Windows 95, plus!95 and other software.
A new cab compression package is adopted, which has the advantages of high compression rate, good security and not easy to be destroyed, and is welcomed by users and software manufacturers. Many users even want to compress and back up their data files in the form of a cab compression package to minimize the amount of disk space they use to backup files and improve their security. Currently, there are mainly Cabarc and Wincab in the software for making CAB files.
CABARC is a tool for compressing, listing files in a compressed package, and extracting CAB files. CABARC supports wildcard and recursive path searches. But Cabarc uses a command-line interface similar to the usual compression tool.
And there are more parameters, and the current mainstream of the Windows operating system is not very coordinated, it is not very convenient to use.
And Wincab is a new visualization of the CAB compression package software, it has the use of graphical interface, support of the volume compression, can be made with the function of the package cab cabinet (*. EXE file format) and other excellent functions, which fundamentally solves the problem of the CAB compression package production. It is important to note that when you run WinCAB.exe, you must ensure that the Makecab.exe files are also in the same directory.
This article takes Wincab as an example to introduce the process of making a CAB file for an ActiveX control.
3. Compress an ActiveX control into a CAB file
The main steps are:
1 Register the Yourctl.ocx control.
2) Establish Yourctl.inf files.
The INF file is formatted as follows: (in the case of using visual c++6.0)
[Version]
Signature= "$CHICAGO $"
advancedinf=2.0
[Add.Code]
Yourctl.ocx=yourctl.ocx
Mfc42.dll=mfc42.dll
Msvcrt.dll=msvcrt.dll
Olepro32.dll=olepro32.dll
[Yourctl.ocx]
File-win32-x86=thiscab
Clsid={yourctl.ocx's CLSID///In Yourctl.odl file can be found in
fileversion=1,0,0,1
Registerserver=yes
[Msvcrt.dll]
fileversion=6,0,8168,0
Hook=mfc42installer
[Mfc42.dll]
fileversion=6,0,8168,0
Hook=mfc42installer
[Olepro32.dll]
fileversion=5,0,4261,0
Hook=mfc42installer
[Mfc42installer]
File-win32-x86=value=aaaaaaaaaaactivex.microsoft.com/controls/vc/mfc42.cab
Run=% EXTRACT_DIR% \mfc42.exe
Here need to note that the above Msvcrt.dll, Mfc42.dll, Olepro32.dll FileVersion is based on the different versions of VC, for example, in the VC5.0SP3 should be as follows
Olepro32.dll 5,0,4230,1
Mfc42.dll 4,21,0,7303
Msvcrt.dll 5,0,0,7303
Each VC version has a different version number, here are only two common types. In addition, the Mfc42installer download path is used in addition to VC4.1 and earlier versions aaaaaaaaaaactivex.microsoft.com/controls/vc/ Mfc40.cab, other versions use Aaaaaaaaaaactivex.microsoft.com/controls/vc/mfc42.cab.
3) Start Wincab start compression. (Note that Makecab.exe should be in the Wincab directory)
i) Start Wincab, and then execute the "new" command on the Cabinet menu or click the "New Cabinet" button on the shortcut bar to prepare for the next cab compression package.
II) Click the Add file (s) to Cabinet button on the shortcut bar to open the Add file (s) to cabinet dialog box.
III Select the files you want to add to the CAB cabinet and click the Open button to add them to the Wincab file list. Here you only need to add Yourctl.ocx and yourctl.inf two files.
IV) in the Cabinet Path and Name box on the Wincab shortcut bar, enter or use the browse for path and name button to specify the path and file name of the CAB compression pack.
v Specifies the size of the cab compression package in the Cabinet size column.
VI) in the "Compression Method" box, select the appropriate compression.
(vii) Click the "Save cabinet" button, Wincab will be compressed according to the user's requirements.
Viii. after the completion of the compression, Wincab will give a "wincab report" box, to the vast number of users reported on the number of files, compression before and after the file size, compression rate, compression time and so on. At this point, a CAB file is generated.
4. Conclusion
Because the compression ratio of the cab is much higher than our usual ARJ, ZIP, RAR, and other compressed packets (about 20%), which further reduces the disk space occupied by the compressed files, when using this technology to transfer ActiveX controls over the Internet, the network traffic is reduced. Also speeds up the speed of Web page opening.
In addition, because the CAB compression pack has a read-only attribute, after the completion of the creation is not allowed to make any changes, delete, so not susceptible to viruses, misoperation and other problems, security also has to ensure that the majority of users in Windows under the compression of files, backup work when the best choice.
NOTE: * * Fund Project * *, National 973 Plan, (No.: G1998030600).
Reference documents
[1]. Pan. COM principle and application [M]. Beijing: Tsinghua University Press, 1999.
[2]. Packaging ActiveX Controls. Aaaaaaaaaasupport.microsoft.com, 2003.
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.