You can choose to distribute resources (pictures and icons) separately or include them in your executable file or dynamic library.
Whenever you create an executable file, PocketBuilder automatically examines the objects it places in that file to see if they explicitly reference any resources. It then copies all such resources right into the executable file.
PocketBuilder does not automatically copy in resources that are dynamically referenced (through string variables). To get such resources into the executable file, you must use a resource (PKR) file. This is simply a text file in which you list existing resources, including BMP, GIF, and ICO files.
Once you have a PKR file, you can tell PocketBuilder to read from it when creating the executable file to determine which additional resources to copy in. This might even include resources used by the objects in your dynamic libraries, if you decide to put most or all resources in the executable file for performance reasons.
Including DataWindow objects You might occasionally want to include a dynamically referenced DataWindow object (one that your application knows about only through a string variable) in the executable file you are creating. To do this, you must list its name in a PKR file along with the names of the resources you want PocketBuilder to copy into that executable file.
You do not need to do this when creating a dynamic library, because PocketBuilder automatically includes every DataWindow object from the PKL source library in the PKD file.
You might need to include resources directly in one or more dynamic libraries. PocketBuilder does not automatically copy any resources into a dynamic library that you create, even if they are explicitly referenced by objects in that file. You need to create a PKR file that tells PocketBuilder which resources you want in a particular PKD file.
Use a different PKR file for each dynamic library in which you want to include resources. When appropriate, you can even use this approach to generate a dynamic library that contains only resources and no objects. Simply start with an empty PKL file as the source.
When you distribute an application, you can include the image files in addition to the application’s executable file and any dynamic libraries. This can be useful if you expect to revise some of them in the future. However, it requires you to do some more work when you get ready to deliver your application, because you will not be able to use the CAB files generated by the Project painter without modification. For more information, see “Regenerating CAB files”.
Keep in mind also that this is not the fastest approach at runtime, because it requires more searching. Whenever your application needs a resource, it searches the executable file and then the dynamic libraries. If the resource is not found, the application searches for a separate file.
Make sure that your application can find where these separate files are stored; otherwise, it cannot display the corresponding resources. If you plan to install the files in a specific directory on the Pocket PC or Smartphone device, your scripts must reference the files using that path.
An example of delivering separate resources When a resource is referenced at runtime and it has not been included in the executable file or in a dynamic library, PocketBuilder looks for it in the device path provided for the resource. In test mode, you need only make sure the referenced files are in your machine’s search path, but in applications that you deploy to a Pocket PC or Smartphone device, you must include the full path to the location where you install the referenced files.
In test mode on the desktop, if the referenced file is in the search path at runtime, the application can load it as needed. The desktop search path is as follows: current directory, Windows directory, Windows System directory, then all directories in the PATH environment variable.