Contains a version information resource type

This unit contains , a TAbstractResource descendant specialized in handling resource of type RT_VERSION.

Adding this unit to a program's uses clause registers class for type RT_VERSION with TResourceFactory.

This type is internally used

This type is internally used by

Version information resource type

This class represents a resource of type RT_VERSION.

A resource of this type provides version information for a Microsoft Windows executable or dll, which is shown when checking properties of a file in Windows Explorer.

Information is stored in FixedInfo, StringFileInfo and VarFileInfo.

This class doesn't allow its type to be changed to anything else than RT_VERSION, and its name to be different from 1. Attempts to do so result in a EResourceDescChangeNotAllowedException. If you need to access RawData after you modified something, be sure to call UpdateRawData first. This isn't needed however when resource is written to a stream, since TResources takes care of it.

Sample code

This code creates a version information resource

const myVersion : TFileProductVersion = (1,2,0,0); var resources : TResources; aRes : TVersionResource; st : TVersionStringTable; ti : TVerTranslationInfo; begin aRes:=TVersionResource.Create(nil,nil); //it's always RT_VERSION and 1 respectively resources:=TResources.Create; resources.Add(aRes); aRes.FixedInfo.FileVersion:=myversion; aRes.FixedInfo.ProductVersion:=myversion; aRes.FixedInfo.FileFlagsMask:=VS_FFI_FILEFLAGSMASK; aRes.FixedInfo.FileFlags:=0; aRes.FixedInfo.FileOS:=VOS_NT_WINDOWS32; aRes.FixedInfo.FileType:=VFT_APP; aRes.FixedInfo.FileSubType:=0; aRes.FixedInfo.FileDate:=0; st:=TVersionStringTable.Create('041004B0'); //Italian, unicode codepage st.Add('CompanyName','Foo Corporation'); st.Add('FileDescription','Foo suite core program'); st.Add('FileVersion','1.2'); st.Add('ProductVersion','1.2'); aRes.StringFileInfo.Add(st); ti.language:=$0410; //Italian ti.codepage:=$04B0; //Unicode codepage aRes.VarFileInfo.Add(ti); resources.WriteToFile('myresource.res'); resources.Free; //destroys aRes as well. end;
Creates a new version information resource

Please note that aType and aName parameters are not used, since this class always uses RT_VERSION as type and 1 as name.

Ignored. Can be nil. Ignored. Can be nil. Language independent part of version information TVersionFixedInfo Language dependent part of version information TVersionStringFileInfo List of supported languages TVersionVarFileInfo