Next: , Previous: Creating a Spec for Ada DLLs, Up: Mixed-Language Programming on Windows


9.3.5.20 GNAT and Windows Resources

Resources are an easy way to add Windows specific objects to your application. The objects that can be added as resources include:

For example, a version information resource can be defined as follow and embedded into an executable or DLL:

A version information resource can be used to embed information into an executable or a DLL. These information can be viewed using the file properties from the Windows Explorer. Here is an example of a version information resource:

    1 VERSIONINFO
    FILEVERSION     1,0,0,0
    PRODUCTVERSION  1,0,0,0
    BEGIN
      BLOCK "StringFileInfo"
      BEGIN
        BLOCK "080904E4"
        BEGIN
          VALUE "CompanyName", "My Company Name"
          VALUE "FileDescription", "My application"
          VALUE "FileVersion", "1.0"
          VALUE "InternalName", "my_app"
          VALUE "LegalCopyright", "My Name"
          VALUE "OriginalFilename", "my_app.exe"
          VALUE "ProductName", "My App"
          VALUE "ProductVersion", "1.0"
        END
      END
    
      BLOCK "VarFileInfo"
      BEGIN
        VALUE "Translation", 0x809, 1252
      END
    END

The value 0809 (langID) is for the U.K English language and 04E4 (charsetID), which is equal to 1252 decimal, for multilingual.

This section explains how to build, compile and use resources. Note that this section does not cover all resource objects, for a complete description see the corresponding Microsoft documentation.