
03-27-2007, 05:10 PM
|
| D-Web Analyst | | Join Date: Mar 2007
Posts: 299
| |
Packaging the ActiveX control Here I have given the procedure to package the ActiveX Control for putting in the web page.
We have to take care of the following steps • Cabinet Files
• Packaging the Sample ActiveX Control
• Cabarc.exe
• INF Files Cabinet Files For a number of years, Microsoft used cabinet (.cab) files to compress software that was distributed on disks. Originally, these files were used to minimize the number of disks shipped with packaged product; today, .cab files are used to reduce the file size and the associated download time for Web content that is found on the Internet or corporate intranet servers.
The .cab file format is a nonproprietary compression format, also known as MSZIP, that is based on the Lempel-Ziv data-compression algorithm. (Other compression formats might also be supported later.) Accessing Controls Stored in Cabinet Files An ActiveX control is identified by the OBJECT object in an HTML file. If the control has been stored in a .cab file, OBJECT must include a CODEBASE attribute that specifies the URL for this .cab file. The following excerpt from a sample HTML file demonstrates how the OBJECT object and CODEBASE attribute are used.
<OBJECT CLASSID="clsid:dcf0768D-ba7a-101a-b57a-0000c0c3ed5f"
CODEBASE="http://webserver/time.cab"
ALIGN="CENTER" WIDTH=270 HEIGHT=26 ID="T1"><PARAM NAME="Interval" VALUE=1000>
<PARAM NAME="Enabled" VALUE=1></OBJECT>
Microsoft Cabinet Software Development Kit (SDK)The Cabinet Software Development Kit provides developers with the components needed to use the Microsoft .cab file technology, or build .cab file management tools. One of the tools available in the Cabinet Software Development Kit is Cabarc.exe. This command-line application enables you to compress an ActiveX control and store it in a .cab file. In addition to creating .cab files, you can use Cabarc.exe to list the contents of or extract files from an existing .cab file. Installing the Cabinet Development KitTo package an ActiveX control, it's necessary to install Cabarc.exe, a tool you download with the Cabinet Software Development Kit. When the Cabinet Software Development Kit is installed, you can begin using the tools it contains to build the necessary .cab files for your control. Creating the .inf File As previously stated, the sample .cab file bundles a Windows 95 or later .inf file with an x86 binary. The bundled .inf file contains information about the control, such as its name, its class identifier (CLSID), the name and location of required DLLs, whether the control requires registration, and so on. This .inf file has the following format. [version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Add.Code]
time.ocx=time.ocx
msvcrt.dll=msvcrt.dll
mfc42.dll=mfc42.dll
olepro32.dll=olepro32.dll
[time.ocx]
file-win32-x86=thiscab
clsid={DCF0768D-BA7A-101A-B57A-0000C0C3ED5F}
FileVersion=1,0,0,0
RegisterServer=yes
[msvcrt.dll]
FileVersion=4,20,0,6164
hook=mfc42installer
[mfc42.dll]
FileVersion=4,2,0,6256
hook=mfc42installer
[olepro32.dll]
FileVersion=4,2,0,6068
hook=mfc42installer
[mfc42installer]
file-win32-x86=http://activex.microsoft.com/controls/vc/mfc42.cab
run=%EXTRACT_DIR%\mfc42.exe Building the .cab FileAfter you've installed Cabarc.exe and built the .inf file for your package, you can build the .cab file. In the case of the sample .cab file, this entailed running Cabarc.exe with the following arguments. cabarc.exe -s 6144 N time.cab time.ocx time.inf
This command created a .cab file named Time.cab, which contains a compressed x86 binary for the sample control as well as a compressed version of the corresponding .inf file. The -s 6144 switch specifies that Cabarc.exe should allocate 6144 bytes for a digital certificate. (Code signing with digital certificates is described briefly in the next section). Signing the .cab File Use the Signcode.exe utility (and accompanying wizard), which also comes with Authenticode technology, to sign the .cab file.
signcode -prog mycab.cab -spc cert.spc -pvk mykey
If Signcode.exe is successful, it will have embedded a PKCS #7 certificate in the .cab file. Hope you can understand how to package the activeX control.
thanks 
__________________ Karpagarajan. R Necessity is the mother of invention |