(SST) ShlWAPIFunctionInfo Version 1.0

Developer Reference
TSSTDllVerInfo Class
Ckass that facilitates retrieving standadized version information from the resources of a Windows executable.
Scope
Global (i.e. objects (of this class) can be instatiated in other units).
Syntax
TYPE TSSTDllVerInfo = CLASS(TObject)
> Hierarchy
> Constructors
Arrow Properties
Arrow Methods
> Events
> Member Variables
Legend: Private declararion Private Protected declaration Protected Public Public Published declaration Published  
Remarks
Implement instances of this class to retrieve the version number, manufacturer, etc. from the resources of a 32 (or 64) bit, Windows executable.
Specifically it can be used to retrieve the binary values assigned to the TVSFixedFileInfo record and the strings assigned to the following predefined, versiion info., string-names; Comments, CompanyName, FileDescription, FileVersion, InternalName, LegalCopyright, LegalTrademarks, OriginalFilename, PrivateBuild, ProductName, ProductVersion, and SpecialBuild.
As the class was designed to be created, used, and freed in a single function, it is not entirely thread-safe. It is therefore not recommended to instantiate an instance of this class in one thread and call its methods or read its properties in another.
In its present implementation, the class' properties and methods do not retrieve custom version information. However, it is very easy to implement a method in a derived class that does, provided the version information string-name is known. The following code snippet provides an example how a method and property that retrieve the string-value assigned to a hypothetical, version information string-name "CustomVerStrName" could be implemented.
Type TSSTDllDerivedVerInfo = Class(TSSTDllVerInfo); ... Function RetCustomVerInfoStr() : String; ... Property CustomVerInfoStr : String Read RetCustomVerInfoStr; end; ... Function TSSTDllDerivedVerInfo.RetCustomVerInfoStr() : String; //"CustomVerStrName" is the custom string name of the version information resource string, //as defined in the resource definition (.rc) file of the executable from which it //is to be retrieved. It must, obviously, be known to implement this function. Var verquerystr : STRING; Var customverinfo : STRING; begin verquerystr := ''; customverinfo := ''; verquerystr := '\StringFileInfo\' + ResourceLanguageIdAsStr + '\CustomVerStrName'; customverinfo := WinApiVerQueryValueStr(verquerystr); RetCustomVerInfoStr := customverinfo; //Return the retrieved value-string end;
> Example
This exmaple is an abridged form of the RunRunctionNamesTest and LogDllVersionInfo methods, taken from the main window unit of the ShlWAPIFunctionInfo project's source code (which see). It exemplifies just how simple it is to retrieve the version information commonly authored in Windows executables.
Requirements
Unit (Declared and implemented in) ShlWAPIFunctionInfo.pas
Library ShlWAPIFunctionInfo.dcu/ShlWAPIFunctionInfo.obj
Unicode Implemented as ANSI version only.
See Also
TForm1, TSSTWinResLanguageId, Source Code
 
Windows APIs: GetFileVersionInfo, GetFileVersionInfoSize, VerQueryValue, VS_FIXEDFILEINFO, VS_VERSIONINFO

Document/Contents version 1.00
Page/URI last updated on April 28, 2022
 
Copyright © Stoelzel Software Technologie (SST) 2010 - 2017
Suggestions and comments mail to:
webmaster@stoelzelsoftwaretech.com