A CAB file is a platform-specific package containing all the files that your application needs, together with information about the application. The Microsoft Windows CE Cab Wizard (cabwiz.exe), a tool that builds CAB files, is installed in the Sybase\PocketBuilder 2.5\Support\Cabwiz directory when you install PocketBuilder. When you select the Create CAB File for Distribution check box in the Project painter, PocketBuilder invokes the Cab wizard to create the file when you build the project.
Smartphone platforms PocketBuilder uses the Microsoft Smartphone Cab Wizard (cabwizsp.exe) to generate CAB files for the Smartphone. The wizard executable is available in the Tools directory of the Smartphone 2003 SDK. You must place this file in the PocketBuilder\Support\Cabwiz directory before you can generate a CAB file for Smartphone platforms.
You can download the Smartphone 2003 SDK from the Microsoft Web site.
For more information about CAB files, see the Microsoft Web site
When you choose to create a CAB file from the Project painter, PocketBuilder creates the files listed in Table 27-6 in the same directory as the PKL that contains the project object.
Filename |
Description |
---|---|
AppName.ARM.CAB |
The Windows CE cabinet files that you distribute to users as described in “Distributing the application”. |
AppName.inf |
The generated cabinet information (INF) file. This single ANSI text file has internal options for all selected platforms. The INF file merges your settings in the Project painter with the cab_template.inf file installed in the Support\cabwiz directory. |
AppName_makecab.bat |
A batch file that runs the Cab wizard (CABWiz.exe or CABWizSP.exe, depending on the platform selected for your project) using the generated AppName.inf file. This batch file, the INF file, and the platform-specific executable files let you regenerate the CAB files outside of the PocketBuilder environment. |
AppNname.exe.ARM |
Platform-specific executable files generated by PocketBuilder for use with the batch file. |
err.log |
A text file containing warnings and other messages from the Cab wizard. In general, warnings can be ignored. |
AppNname.ARM.DAT |
Temporary files generated by the Cab wizard. These files are used internally by Windows CE. |
In Table 27-6, AppName is the name you supplied for the executable file in the Project painter. It is used as the base name of all the files generated when you choose to build a CAB file.
The information you supply in the Version group box in the Project painter is stored in the CAB file. After the CAB file is installed on an emulator or Pocket PC device, the company name and product name are visible in the list of programs in storage memory that displays when you select Settings>System>Remove Programs.
The INF file generated by the Project painter merges your settings with a template file, cab_template.inf, installed in the Support\cabwiz directory. If you are familiar with the structure of INF files, you can customize the CAB files generated by PocketBuilder by modifying the template.
Make a backup copy Before you make any modifications to the cab_template.inf file, make a backup copy so that you can restore the default settings if necessary.
For more information about INF files, see the Microsoft Web site
You can make modifications to the generated INF file, such as adding additional files, registry entries, and shortcuts, by editing the INF file in a text editor.
Regenerating overwrites modifications If you regenerate the CAB file in the Project painter, your changes to Appname.inf are overwritten. After modifying an INF file, make a backup copy of the modified file with a different name so that you can reapply your changes.
When you run the AppName_makecab.bat batch file, it uses your edited INF file and the platform-specific executable files generated by the Project painter to build CAB files for all the platforms you selected in the Project painter. You must have a copy of the AppName.exe file to rebuild the CAB files. If you clear the Delete Temporary Files After Build check box in the project painter before you build the project, the AppName.exe and any required PKD files are saved to the build directory.
Errors when running the AppName_makecab.bat batch file are written to the err.log file.
Example Suppose you want to install your files in one location, but make the application accessible to the user by placing a shortcut in a company-specific folder that displays when you select Programs from the Start menu on the device.
In this example, the company name is AcmeTools and the product is Bug Zapper. The executable will be installed in the \Acme Tools directory, and the shortcut in \Windows\Start Menu\Programs.
In the generated INF file, locate the CEStrings section. It shows the name of the application and the installation directory you provided in the Version group box in the Project painter:
[CEStrings] AppName = "Bug Zapper" InstallDir = "\AcmePrograms"
Change the InstallDir line to the following:
InstallDir = %CE11%"\Acme Tools"
The executable will be installed in the Acme Tools directory as long as the %InstallDir% variable remains specified in the DestinationDirs section of the INF file. If this directory does not exist, it will be created.
Add a line that defines the shortcut to the Shortcuts.All section:
[Shortcuts.All] "Bug Zapper",0,"bugzapper.exe",%CE11%
Bug Zapper
is the name
of the shortcut, 0
indicates
the shortcut is to a file and not to a folder, bugzapper.exe
is
the target of the shortcut, and %CE11%
is
the location where the shortcut will be installed.
%CE11%
represents
the \Windows\Start Menu\Programs directory.
For a list of other identifiers (macro strings), see Windows CE directory identifiers.
Save the INF file, run bugzapper_makecab.bat, and check the err.log file for errors.
After you install the regenerated CAB file on a device or emulator, an Acme Tools folder that contains the Bug Zapper shortcut displays when you select Programs.