Creating CAB and internationalization

 

Many of you ask about creating your own CAB, so you can add your own dlls and 3rd party components. Also you ask on how to localize your web application that use the VDF Wrapper component in your language.

Creating a Web installation CAB

In general, you will have to create a setup that will contain the exe/library you made and 3rd party dlls that are required, and also add the VectorDraw Merge Module that we provide (see http://www.vdraw.com/redis_v6xxx.htm, you might also need to add some Microsoft's MSMs that can be downloaded from our website as you can see below). After you create this setup (you can try it by running it in a clean machine and then trying to see the webpage you made). Then you will have to put this setup you made inside the CAB. You can check also our CAB file (can be downloaded from here), which is very simple, it contains an INF file with the necessary information for our ActiveX (VDF Wrapper) and a setup (files setup.exe and VDFCAB.msi) which is a very simple setup that contains the MergeModule that we provide and can be used to install our libraries/components.

 

1. Creating the setup

So lets start with the Setup project. Open the Visual Studio 2005 and choose to create a new Setup Project. Set "MyCAB" for the name and set the C:\Projects location.

In the C:\Projects\MyCAB folder create a new folder named "VS8_MergeModules" and there extract the files from the zip file that you can download from http://www.vdraw.com/Developer/downloads/MS-MSM-VC90.zip and also place the VdrawFrameWork.msm for versions 6019 and older or VdrawCOM_Module.msm for version 6020 and above that you can download from http://www.vdraw.com/hotfixes.htm. Make sure that the VDF components installed in your development machine and used to produce your executables/dlls etc is the same version as this MSM.

Click on the MyCAB project and in the properties set the "SearchPath" property to C:\Projects\MyCAB\VS8_MergeModules.

Right-click on the MyCAB project in the Solution Explorer and choose Add > Merge Module ... go to the C:\Projects\MyCAB\VS8_MergeModules and choose the VdrawFrameWork.msm or VdrawCOM_Module.msm. This Merge Module along with some other msms will be added in the setup project.

Click on the MyCAB project and in the properties set the Author, Description, Manufacter, Title etc properties.

Up to this moment, the setup that will be created if you press the "build" button (files setup.exe and MyCAB.msi) and after running it on a "clean" machine it will install all the necessary libraries dlls etc that the VDF components need. Now you can add your executables/dlls/3rd party components & dlls etc

If you like you can add in the setup the International Resources that will be used in your project. For more information on this see chapter "Internationalization" below.

Open and Save .DWG/.DGN Files

If you want to open/save .DWG/.DGN files from your application then you can do it with two ways :

1) If your are not member of OpenDesign Alliance then your "user" must download and install our FileConverter Full/Lite setup from our website, and press the "I agree" button in the FileConverters EULA.

2) If your are member of OpenDesign Alliance then you can use the libraries that OpenDesign provides in the setup. If you are using version 6018 and above then the new Teigha libraries from OpenDesign must be used. For more information email us.

The setup is now ready. The next step is to produce a CAB file from this setup.

 

2. Creating the CAB

Create a new folder named "makecab" in the C:\Projects\MyCAB folder. There place the MAKECAB.EXE utility, signcode.exe and lpk_tool.exe (all these can be found on Microsoft's MSDN website). MAKECAB.exe will produce the CAB file, signcode.exe will add to your CAB the sign of your company (like from Verisign) and the lpk_tool.exe will be used to create a <something>.lpk license file that is required in your web page. The CAB that we make in this example is made for the vdraw.ocx component and it uses its CLSID which is 50585480-E1F3-432a-A9D6-C694EDC9A12D. If you want to make it for another library then you have to specify your library's CLSID, see MyCab.inf file below

With notepad create a MyCab.bat file inside makecab folder that will contain these lines :

cd C:\Projects\MyCab\makecab
MAKECAB.EXE /f C:\Projects\MyCab\makecab\MyCab.ddf /L C:\Projects\MyCab\makecab
signcode.exe -spc "mycredentials.spc" -v "myprivatekey.pvk" -n "My Web Installation" -i "http://www.my--url.here" -a sha1 C:\Projects\MyCab\makecab\MyCAB.cab

signcode is needed when you want mark as safe the CAB you are making.


With notepad create a MyCab.ddf  inside makecab folder that will contain these lines :

.OPTION EXPLICIT
.Set Cabinet=on
.Set Compress=on
.Set MaxDiskSize=CDROM
.Set ReservePerCabinetSize=6144
.Set DiskDirectoryTemplate=
.Set CompressionType=MSZIP
.Set CompressionLevel=7
.Set CompressionMemory=21
.Set CabinetNameTemplate = MyCAB.cab
.Set DiskDirectory1 = .
"C:\Projects\MyCab\Release\setup.exe"
"C:\Projects\MyCab\Release\MyCAB.msi"
"C:\Projects\MyCab\makecab\MyCab.inf"


and also create in this folder a MyCab.inf file that will contain these lines :

[DefaultInstall]
CopyFiles=install.files

[DestinationDirs]
install.files=01

[install.files]
setup.exe,,setup.exe,32;
MyCAB.msi,,MyCAB.msi,32;

[setup.exe]
file-win32-x86=thiscab

[MyCAB.msi]
file-win32-x86=thiscab

[SourceDisksNames]
1="default",,1

[version]
signature="$CHICAGO$"
AdvancedINF=2.0

[Add.Code]
vdraw.ocx=vdraw.ocx

[vdraw.ocx]
hook=mycabmsi.cab_Installer
FileVersion=6,1,6010,0
clsid={50585480-E1F3-432a-A9D6-C694EDC9A12D}
RegisterServer=Yes


;;;;;;;;;;;hooks;;;;;;;;;;;;;;;;;
[mycabmsi.cab_Installer]
run=%EXTRACT_DIR%\setup.exe

Change the FileVersion number with the version number of the VDF component you use to make your application and setup.

If you want to sign this cab then you have to copy in this makecab folder the mycredentials.spc and myprivatekey.pvk key files (these are the default names that Verisign give to its customers). If you don't like to sign the cab then ignore this step and remove the last like from the  MyCab.bat file.

The last step is to run the myCab.bat. This will produce the CAB that you can use in your web application. More information on how to make a simple HTML file that contains the VDF Wrapper 6.x component, the LPK file and the CAB file you just made can be found here : http://www.vdraw.com/Export6/60000100-Use the VDF component 6005 and above in HTML (InternetExplorer).htm

 

Internationalization

As mentioned above you can have your own language in the VDF component.

If you like you can add in the setup the International Resources (see http://www.vdraw.com/Export6/60000089-Globalization of Resources.htm) if you want to translate the VDF components in your language. You will have to change  the Menu.txt, Commands.txt and vdres.txt in your language and save them as UNICODE txts. Then translate, change/alter the icons and build the vdFormsRes project (this project is provided by us) to produce the vdFormsRes.dll file. Note that you have to set the vdFormsRes.dll Register property to vsdrfDoNotRegister. Add these 4 files to your setup too. These four files will be installed in a folder like [ProgramFiles]\MyCab and you will have to set your web application's Resources Directory to this folder, like stated in the above article.

If you like to make a web page in more than one language (like French, German, Italian etc) then it is better to not add all these resources in the setup/cab but to upload these files in different folders in your web server like http://[webapplicationurl]/locales/fr, http://[webapplicationurl]/locales/de, http://[webapplicationurl]/locales/it and with VBScript/JavaScript code change these resources depending on the customer request.

For example in the  http://[webapplicationurl]/locales/fr you can upload the French Menu.txt, Commands.txt, vdres.txt and also the vdFormsRes.dll. Then with VBScript or Javascript you can make a call like :

Dim irpath
    irpath= "http://[webapplicationurl]/locales/fr"
    VDraw.VdrawRes = irpath

in the CreateControl event. This will make the VDraw.ocx automatically find, download and use the Menu.txt, Commands.txt, vdres.txt and vdFormsRes.dll so all VDraw messages/texts are displayed in preferred language.