How to Link External Resources

Top  Previous  Next

The Project System (Solution Explorer) allows you to specify external resources to link into the executable. These include graphics, such as .BMP, .ICO and .WMF files. By linking them into the executable, you can avoid having to ship them as separate, external files.

If you directly reference a graphic file within a data structure, the compiler automatically links the graphic, so there is no need to add the graphic file to your Project Tree. For example, if you place an IMAGE control in a window, and specify a file by name in the Properties Pad dialog, the linker automatically includes that file in your executable. But if you assign a different graphic to a control using a runtime property assignment statement, the linker will only include the new file in your executable if you add the file to your Project Tree.

To add graphic files to the executable:


In the Solution Explorere, RIGHT-CLICK on the Libraries, Objects and Resource files note and select the Add Libraries, Objects and Resource files menu item.

Select the bitmap, icon, or metafile graphic from the standard Open File dialog.


Press the Open button to return to the Solution Explorer.


Highlight the source code file that references the graphic in the Application Tree, press the Embeds button, and locate the appropriate Embed point.

The source code file is opened by the Text Editor.


Place a tilde (~) in front of the graphic file name in the source code assignment statement (not in data section).

For example: change ?Image{PROP:Text} = 'I.ICO' to ?Image{PROP:Text} = '~I.ICO.' The tilde indicates the program should find the item as a linked in resource, not as an external file.

Optionally, choose Search Find to locate the file name.


Choose Save and Close, then CLICK on Yes when asked if you want to save.

Now, when you recompile and link, the executable will no longer require the external graphic file.