Стартовый пул

This commit is contained in:
2024-04-02 08:46:59 +03:00
parent fd57fffd3a
commit 3bb34d000b
5591 changed files with 3291734 additions and 0 deletions

93
dd-verinfo/ChangeLog.txt Normal file
View File

@@ -0,0 +1,93 @@
; ------------------------------------------------------------------------------
; This Source Code Form is subject to the terms of the Mozilla Public License,
; v. 2.0. If a copy of the MPL was not distributed with this file, You can
; obtain one at http://mozilla.org/MPL/2.0/
;
; Copyright (C) 2013, Peter Johnson (www.delphidabbler.com).
;
; $Rev: 1132 $
; $Date: 2013-01-14 03:31:09 +0000 (Mon, 14 Jan 2013) $
;
; Change Log for Version Information Component
; ------------------------------------------------------------------------------
Release v3.3.1 of 14 January 2013
+ Unit names are now qualified with namespace name on Delphi XE2 and later.
+ Changes to demo projects:
- Font and appearance of some controls changed.
- Controls are now themed.
- All form files now in text format.
- Forms are no longer scaled.
- 1st demo program's main window now resizes.
- 2nd demo dialogues' "help" buttona now display online examples instead of help file topics.
- Demos now need Delphi 7 as a minimum.
- New project configurations files.
+ Component source license changed to Mozilla Public License v2.0. (Demos now placed in public domain).
+ MPL text file and documentation wiki shortcut have had names changed.
+ WinHelp help file regenerated with updated copyright date.
+ Documentation revised.
Release v3.3 of 03 November 2010
+ Added operator overloads to TPJVersionNumber record when compiled with Delphi 2006 and later to:
- Support equality tests using =, <>, <, <=, > and >= operators.
- Support implicit casting to a string which formats the version number as a dotted quad (issue #12: http://code.google.com/p/ddab-lib/issues/detail?id=12).
+ Added new helper functions primarily for use with Delphi 2005 and earlier:
- CompareVerNums - compares two version number records.
- VerNumToStr - formats a version number as a dotted quad.
+ Updated TPJVersionNumber topic in help file re changes.
+ Updated HTML documentation.
Release v3.2 of 09 November 2009
+ Changed method used to get character set descriptions. These are now obtained from operating system where possible instead of from hard-wired values.
+ Added compiler directive to switch off unsafe code warnings on compilers that support the directive.
+ Added copy of Mozilla Public License.
+ Corrected error in help file.
+ Modified Demo 2 to enable it to compile on Delphi 2 and 3.
+ Updated documentation and included shortcut file that links to component Wiki.
Release v3.1.1 of 11 December 2005
+ Changed component to Mozilla public license.
+ Fixed minor bug in VIDemo project.
+ Revised HelpEgs demo project to access related help file topics.
+ Updated help file to make examples available from component's main page.
+ Updated HTML documentation.
Release v3.1 of 07 September 2003
+ Fixed to be compatible with C++ Builder - direct access to fields of TVSFixedFileInfo in property declarations were replaced by calls to an indexed property getter function.
Release v3.0.1 of 08 July 2003
+ Changed component palette from PJSoft to DelphiDabbler.
+ Updated HTML documentation.
+ Changed copyright message in help file.
Release v3.0 of 17 February 2002
+ Added ability to access all "translations" stored in a file's version information, rather than just first one. This has been done so that code using earlier versions of this component should continue to work unchanged.
+ Added new property to expose fixed file information record.
+ Added new "string array" property to give access to string information by name: this property can access any custom string information if the name is known.
+ Added properties to return number of "translations" and to select index of "translation" to be used.
+ Added properties to return language and character set codes in addition to descriptive strings.
+ All string info, language and character set properties now return values from the currently selected translation (which defaults to the first translation maintaining backward compatibilty).
+ Empty FileName property now accesses name of host application per command line rather than using Application.ExeName.
+ CharSet property now returns '' for unknown value rather than 'Unknown'.
+ Renamed TVersionNumber record to TPJVersionNumber.
+ Replaced Tvs_FixedFileInfo record with use of Windows unit defined type TVSFixedFileInfo.
+ Renamed unit to PJVersionInfo.
+ Changed component palette from "PJ Stuff" to "PJSoft".
+ Added two demo programs, one is a sample version information reading program and the other implements examples from the help file.
Release v2.1 of 28 November 1999
+ Changed unit name from VerInfo to VInfo to allow component to install under Delphi 3 & 4 (VerInfo clashes with an existing unit in these versions).
+ Removed superfluous conditional compilation directives.
+ Updated HTML documentation to separate 16 bit from 32 bit version, to to include installation notes for Delphi 3/4 and to include update history.
Release v2.0.1 of 08 July 1999
+ Changed palette where component installs to "PJ Stuff" from "Own".
+ Added HTML documentation (shared documentation with Release 1.0.1).
+ Included 16 bit Version Information Component release v1.0.1
Un-released v2.0 of 06 December 1998
+ Forked development - 32 bit development (this fork) began with v2.0 while the 16 bit version continued with v1.0.1
+ Revised for use with Win32 - not backwards compatible with v1.0
Un-released v1.0 of 26 April 1998
+ Original version - 16 bit only.

View File

@@ -0,0 +1,221 @@
object MainForm: TMainForm
Left = 492
Top = 162
Width = 599
Height = 672
Color = clBtnFace
Constraints.MinHeight = 360
Constraints.MinWidth = 320
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -12
Font.Name = 'Arial'
Font.Style = []
OldCreateOrder = True
Position = poScreenCenter
Scaled = False
OnCreate = FormCreate
OnDestroy = FormDestroy
DesignSize = (
583
634)
PixelsPerInch = 96
TextHeight = 15
object bvlSpacer1: TBevel
Left = 0
Top = 0
Width = 583
Height = 5
Align = alTop
Shape = bsTopLine
end
object sbFileName: TSpeedButton
Left = 545
Top = 9
Width = 29
Height = 27
Hint = 'Click to browse for files.'
Anchors = [akTop, akRight]
Caption = '...'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
OnClick = sbFileNameClick
end
object gpFixed: TGroupBox
Left = 0
Top = 79
Width = 583
Height = 202
Anchors = [akLeft, akTop, akRight]
Caption = ' Fixed File &Information '
TabOrder = 0
DesignSize = (
583
202)
object lvFixed: TListView
Left = 10
Top = 20
Width = 562
Height = 173
Anchors = [akLeft, akTop, akRight, akBottom]
Columns = <
item
Caption = 'Item'
Width = 148
end
item
Caption = 'Value'
Width = 410
end>
GridLines = True
Items.Data = {
F50000000700000000000000FFFFFFFFFFFFFFFF00000000000000000C46696C
652056657273696F6E00000000FFFFFFFFFFFFFFFF00000000000000000F5072
6F647563742056657273696F6E00000000FFFFFFFFFFFFFFFF00000000000000
000F46696C6520466C616773204D61736B00000000FFFFFFFFFFFFFFFF000000
00000000000A46696C6520466C61677300000000FFFFFFFFFFFFFFFF00000000
00000000104F7065726174696E672053797374656D00000000FFFFFFFFFFFFFF
FF00000000000000000946696C65205479706500000000FFFFFFFFFFFFFFFF00
000000000000000D46696C65205375622D74797065}
ReadOnly = True
RowSelect = True
TabOrder = 0
ViewStyle = vsReport
OnMouseMove = lvMouseMove
end
end
object gpVar: TGroupBox
Left = 0
Top = 296
Width = 583
Height = 311
Anchors = [akLeft, akTop, akRight, akBottom]
Caption = ' Variable Information '
TabOrder = 1
DesignSize = (
583
311)
object lblTrans: TLabel
Left = 10
Top = 20
Width = 65
Height = 15
Caption = 'Tr&anslation:'
FocusControl = cmbTrans
end
object lblStr: TLabel
Left = 10
Top = 75
Width = 120
Height = 15
Caption = '&String File Information'
FocusControl = lvStr
end
object cmbTrans: TComboBox
Left = 10
Top = 39
Width = 562
Height = 23
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
ItemHeight = 15
TabOrder = 0
OnChange = cmbTransChange
end
object lvStr: TListView
Left = 10
Top = 95
Width = 562
Height = 205
Anchors = [akLeft, akTop, akRight, akBottom]
Columns = <
item
Caption = 'Name'
Width = 148
end
item
Caption = 'String'
Width = 410
end>
GridLines = True
Items.Data = {
A70100000C00000000000000FFFFFFFFFFFFFFFF000000000000000008436F6D
6D656E747300000000FFFFFFFFFFFFFFFF00000000000000000C436F6D70616E
79204E616D6500000000FFFFFFFFFFFFFFFF00000000000000001046696C6520
4465736372697074696F6E00000000FFFFFFFFFFFFFFFF00000000000000000C
46696C652056657273696F6E00000000FFFFFFFFFFFFFFFF0000000000000000
0D496E7465726E616C204E616D6500000000FFFFFFFFFFFFFFFF000000000000
00000F4C6567616C20436F7079726967687400000000FFFFFFFFFFFFFFFF0000
000000000000104C6567616C2054726164656D61726B7300000000FFFFFFFFFF
FFFFFF0000000000000000124F726967696E616C2046696C65204E616D650000
0000FFFFFFFFFFFFFFFF00000000000000000D50726976617465204275696C64
00000000FFFFFFFFFFFFFFFF00000000000000000C50726F64756374204E616D
6500000000FFFFFFFFFFFFFFFF00000000000000000F50726F64756374205665
7273696F6E00000000FFFFFFFFFFFFFFFF00000000000000000D537065636961
6C204275696C64}
ReadOnly = True
RowSelect = True
TabOrder = 1
ViewStyle = vsReport
OnMouseMove = lvMouseMove
end
end
object edFileName: TEdit
Left = 10
Top = 10
Width = 523
Height = 23
Hint =
'Enter the name of a file here (or drag one from Explorer), then ' +
'press Refresh.'
Anchors = [akLeft, akTop, akRight]
TabOrder = 2
end
object btnRefresh: TButton
Left = 10
Top = 42
Width = 92
Height = 31
Hint = 'Click to display version info for the above file.'
Caption = '&Refresh'
Default = True
TabOrder = 3
OnClick = btnRefreshClick
end
object btnClose: TButton
Left = 481
Top = 42
Width = 93
Height = 31
Hint = 'Click to exit.'
Anchors = [akTop, akRight]
Cancel = True
Caption = '&Close'
TabOrder = 4
OnClick = btnCloseClick
end
object sbHints: TStatusBar
Left = 0
Top = 612
Width = 583
Height = 22
AutoHint = True
Panels = <>
SimplePanel = True
end
object dlgBrowse: TOpenDialog
Filter = 'All files|*.*'
Options = [ofHideReadOnly, ofFileMustExist]
Title = 'Browse'
Left = 96
Top = 34
end
object viInfo: TPJVersionInfo
Left = 128
Top = 34
end
end

View File

@@ -0,0 +1,499 @@
{
* FmVIDemo.pas
*
* Main form for Version Information Component VIDemo demo program.
*
* $Rev: 1109 $
* $Date: 2013-01-13 23:19:20 +0000 (Sun, 13 Jan 2013) $
*
* Any copyright in this file is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
}
unit FmVIDemo;
{$UNDEF Supports_RTLNameSpaces}
{$IFDEF CONDITIONALEXPRESSIONS}
{$IF CompilerVersion >= 15.0} // >= Delphi 7
{$WARN UNSAFE_CODE OFF}
{$IFEND}
{$IF CompilerVersion >= 23.0} // Delphi XE2
{$DEFINE Supports_RTLNameSpaces}
{$IFEND}
{$ENDIF}
interface
uses
// Delphi
{$IFDEF Supports_RTLNameSpaces}
Vcl.ComCtrls, Vcl.StdCtrls, Vcl.Buttons, Vcl.Dialogs, Vcl.Controls,
System.Classes, Vcl.Forms, Winapi.Windows, Winapi.Messages, Vcl.ExtCtrls,
{$ELSE}
ComCtrls, StdCtrls, Buttons, Dialogs, Controls, Classes, Forms, Windows,
Messages, ExtCtrls,
{$ENDIF}
// DelphiDabbler component
PJVersionInfo;
type
TMainForm = class(TForm)
dlgBrowse: TOpenDialog;
gpFixed: TGroupBox;
lvFixed: TListView;
gpVar: TGroupBox;
lblTrans: TLabel;
lblStr: TLabel;
cmbTrans: TComboBox;
lvStr: TListView;
bvlSpacer1: TBevel;
viInfo: TPJVersionInfo;
sbFileName: TSpeedButton;
edFileName: TEdit;
btnRefresh: TButton;
btnClose: TButton;
sbHints: TStatusBar;
procedure cmbTransChange(Sender: TObject);
procedure lvMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure btnRefreshClick(Sender: TObject);
procedure sbFileNameClick(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
private
procedure ClearDisplay;
// Clear list views and combo box
procedure Display;
// Display version info for current file, if any
procedure DisplayFFI;
// Display fixed file info for current file
procedure DisplayFFIItem(const Index: Integer; const FFI: TVSFixedFileInfo);
// Display the fixed file item per the given index fixed file info
// structure
procedure DisplayTransInfo;
// Display translation information in combo and selects first item if any
procedure DisplayStringInfo(const TransIdx: Integer);
// Display standard string information for given translation
procedure WMDropFiles(var Msg: TWMDropFiles); message WM_DROPFILES;
// Catch name of file dropped on window and enter in edit control
end;
var
MainForm: TMainForm;
implementation
uses
// Delphi
{$IFDEF Supports_RTLNameSpaces}
System.SysUtils, System.Math, WinApi.ShellAPI;
{$ELSE}
SysUtils, Math, ShellAPI;
{$ENDIF}
{$R *.DFM}
const
// Index of fixed file info in lvFixed
cIdxFileVersion = 0;
cIdxProductVersion = 1;
cIdxFileFlagsMask = 2;
cIdxFileFlags = 3;
cIdxFileOS = 4;
cIdxFileType = 5;
cIdxFileSubType = 6;
cFirstFFIIndex = 0;
cLastFFIIndex = 6;
// The following types and constant table definitions provide information
// required to display descriptions of fixed file information codes from version
// resources
type
TTableEntry = record
// maps codes to descriptions
Code: DWORD;
Desc: string;
end;
const
cFileType: array[0..6] of TTableEntry =
// maps file types to descriptions
(
(Code: VFT_APP; Desc: 'Application'),
(Code: VFT_DLL; Desc: 'DLL'),
(Code: VFT_DRV; Desc: 'Device driver'),
(Code: VFT_FONT; Desc: 'Font'),
(Code: VFT_STATIC_LIB; Desc: 'Static link library'),
(Code: VFT_VXD; Desc: 'Virtual device driver'),
(Code: VFT_UNKNOWN; Desc: 'Unknown')
);
cFileOSBase: array[0..4] of TTableEntry =
// maps base OS codes to descriptions
(
( Code: VOS_NT; Desc: 'Windows NT' ),
( Code: VOS_DOS; Desc: 'MS-DOS' ),
( Code: VOS_OS232; Desc: 'OS2 32 bit' ),
( Code: VOS_OS216; Desc: 'OS2 16 bit' ),
( Code: VOS_UNKNOWN; Desc: 'Any' )
);
cFileOSTarget: array[0..4] of TTableEntry =
// maps target OS codes to descriptions
(
( Code: VOS__WINDOWS32; Desc: '32 bit Windows' ),
( Code: VOS__WINDOWS16; Desc: 'Windows 3.x' ),
( Code: VOS__PM32; Desc: 'Presentation Manager 32' ),
( Code: VOS__PM16; Desc: 'Presentation Manager 16' ),
( Code: VOS__BASE; Desc: 'Unknown' )
);
// The following procedures extract the required descriptions of fixed file
// information codes from the tables above
function CodeToDesc(Code: DWORD;
Table: array of TTableEntry): string;
// Return description of given code using given table
var
I: Integer;
begin
Result := '';
for I := Low(Table) to High(Table) do
if Table[I].Code = Code then
begin
Result := Table[I].Desc;
Break;
end;
end;
function FileOSDesc(OS: DWORD): string;
// Describe OS
var
Target, Base: DWORD;
begin
// get target and base OS
Target := OS and $0000FFFF;
Base := OS and $FFFF0000;
// build description
if Base = VOS_UNKNOWN then
Result := CodeToDesc(Target, cFileOSTarget)
else if Target = VOS__BASE then
Result := CodeToDesc(Base, cFileOSBase)
else
Result := Format('%s on %s',
[CodeToDesc(Target, cFileOSTarget),
CodeToDesc(Base, cFileOSBase)]);
end;
function FileFlagsToStr(Flags: DWORD): string;
// Return string of file flags from given bit set
const
cFileFlags: array[0..5] of TTableEntry =
(
(Code: VS_FF_DEBUG; Desc: 'Debug'),
(Code: VS_FF_PRERELEASE; Desc: 'Pre-release'),
(Code: VS_FF_PATCHED; Desc: 'Patched'),
(Code: VS_FF_PRIVATEBUILD; Desc: 'Private build'),
(Code: VS_FF_INFOINFERRED; Desc: 'Inferred'),
(Code: VS_FF_SPECIALBUILD; Desc: 'Special build') );
var
I: Integer;
begin
Result := '';
for I := Low(cFileFlags) to High(cFileFlags) do
if Flags and cFileFlags[I].Code = cFileFlags[I].Code then
if Result = '' then
Result := cFileFlags[I].Desc
else
Result := Result + ', ' + cFileFlags[I].Desc
end;
function VerFmt(const MS, LS: DWORD): string;
// Format the version number from the given DWORDs containing the info
begin
Result := Format('%d.%d.%d.%d',
[HiWord(MS), LoWord(MS), HiWord(LS), LoWord(LS)])
end;
{ TMainForm }
procedure TMainForm.btnCloseClick(Sender: TObject);
// Close the app
begin
Close;
end;
procedure TMainForm.btnRefreshClick(Sender: TObject);
// Display version info for file name entered in edit control
begin
// Store name of required file in version info component: this reads ver info
viInfo.FileName := edFileName.Text;
// Record file's name in caption
Caption := Format('%s - %s',
[Application.Title, ExtractFileName(viInfo.FileName)]);
// Display info, if any
Display
end;
procedure TMainForm.ClearDisplay;
// Clear list views and combo box
// ---------------------------------------------------------------------------
procedure ClearLV(LV: TListView);
var
Idx: Integer;
begin
for Idx := 0 to Pred(LV.Items.Count) do
if LV.Items[Idx].SubItems.Count > 0 then
LV.Items[Idx].SubItems[0] := '';
end;
// ---------------------------------------------------------------------------
begin
ClearLV(lvFixed);
ClearLV(lvStr);
cmbTrans.Items.Clear;
cmbTrans.ItemIndex := -1;
end;
procedure TMainForm.cmbTransChange(Sender: TObject);
// When user selects a translation from combo box, display its string info
begin
DisplayStringInfo(cmbTrans.ItemIndex);
end;
procedure TMainForm.Display;
// Display version info for current file, if any
begin
// Display version info: display gets cleared and message displayed if no info
if viInfo.HaveInfo then
begin
DisplayFFI;
DisplayTransInfo;
DisplayStringInfo(cmbTrans.ItemIndex);
end
else
begin
ClearDisplay;
MessageDlg(
'No version resource information available for ' + viInfo.FileName,
mtInformation, [mbOK], 0);
end;
end;
procedure TMainForm.DisplayFFI;
// Display fixed file info for current file
var
Idx: Integer; // scans thru all fixed file items
begin
// Display each fixed file item
for Idx := cFirstFFIIndex to cLastFFIIndex do
begin
// Ensure there's a sub item in list view for this item
if lvFixed.Items[Idx].SubItems.Count = 0 then
lvFixed.Items[Idx].SubItems.Add('');
// Display the item
DisplayFFIItem(Idx, viInfo.FixedFileInfo);
end;
end;
procedure TMainForm.DisplayFFIItem(const Index: Integer;
const FFI: TVSFixedFileInfo);
// Display the fixed file item per the given index fixed file info structure
// ---------------------------------------------------------------------------
procedure AddItem(const Index: Integer; const Value: string);
{Set the first sub item of the given list item to the given value}
begin
lvFixed.Items[Index].SubItems[0] := Value;
end;
// ---------------------------------------------------------------------------
begin
// Display the required item
case Index of
cIdxFileVersion:
AddItem(cIdxFileVersion,
VerFmt(FFI.dwFileVersionMS, FFI.dwFileVersionLS));
cIdxProductVersion:
AddItem(cIdxProductVersion,
VerFmt(FFI.dwProductVersionMS, FFI.dwProductVersionLS));
cIdxFileFlagsMask:
AddItem(cIdxFileFlagsMask,
FileFlagsToStr(FFI.dwFileFlagsMask));
cIdxFileFlags:
AddItem(cIdxFileFlags, FileFlagsToStr(FFI.dwFileFlags));
cIdxFileOS:
AddItem(cIdxFileOS, FileOSDesc(FFI.dwFileOS));
cIdxFileType:
AddItem(cIdxFileType, CodeToDesc(FFI.dwFileType, cFileType));
cIdxFileSubType:
case FFI.dwFileType of
VFT_FONT, VFT_DRV, VFT_VXD:
AddItem(cIdxFileSubType, Format('%0.8X', [FFI.dwFileSubType]));
else AddItem(cIdxFileSubType, 'None');
end;
end;
end;
procedure TMainForm.DisplayStringInfo(const TransIdx: Integer);
// Display standard string information for given translation
const
// Details of names of all standard string information
cStrInfoNames: array[0..11] of string = (
'Comments',
'CompanyName',
'FileDescription',
'FileVersion',
'InternalName',
'LegalCopyright',
'LegalTrademarks',
'OriginalFileName',
'PrivateBuild',
'ProductName',
'ProductVersion',
'SpecialBuild'
);
var
Idx: Integer; // index of string info name in table
begin
// Select required translation in version info component
viInfo.CurrentTranslation := TransIdx;
// Display each piece of string info
for Idx := Low(cStrInfoNames) to High(cStrInfoNames) do
begin
// Ensure we have a sub-item of list item in which to display info
if lvStr.Items[Idx].SubItems.Count = 0 then
lvStr.Items[Idx].SubItems.Add('');
// Display string info or empty string if translation is not valid
if viInfo.CurrentTranslation > -1 then
// display string information
lvStr.Items[Idx].SubItems[0] :=
viInfo.StringFileInfo[cStrInfoNames[Idx]]
else
// clear string information
lvStr.Items[Idx].SubItems[0] := '';
end;
end;
procedure TMainForm.DisplayTransInfo;
// Display translation information in combo and selects first item if any
var
TransIdx: Integer; // loops thru all translations
begin
// Set up translations in combo box: indexes of items in combo = trans index
cmbTrans.Clear;
for TransIdx := 0 to Pred(viInfo.NumTranslations) do
begin
viInfo.CurrentTranslation := TransIdx;
cmbTrans.Items.Add(Format('%s - %s', [viInfo.Language, viInfo.CharSet]));
end;
// Select first translation if there is one
if viInfo.NumTranslations > 0 then
cmbTrans.ItemIndex := 0
else
cmbTrans.ItemIndex := -1;
end;
procedure TMainForm.FormCreate(Sender: TObject);
// App starting: initialise (tell Windows we accept file drag/drops)
begin
DragAcceptFiles(Handle, True);
end;
procedure TMainForm.FormDestroy(Sender: TObject);
// App closing: tidy up (no more file drag/drops)
begin
DragAcceptFiles(Handle, False);
end;
procedure TMainForm.lvMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
// Display any info that is too wide for list view column in pop-up window
// when mouse passes over the item
const
{$J+}
LastItem: TListItem = nil; // list item under cursor last time event called
{$J-}
var
LV: TListView; // list view triggering this event
Item: TListItem; // list item, if any, under mouse cursor
StrW: Integer; // width of string in right column for current list item
// ---------------------------------------------------------------------------
procedure SetHint(const HintStr: string);
{Set list view's hint to given string, and switch on hinting if string non-
empty}
begin
LV.Hint := HintStr;
LV.ShowHint := HintStr <> '';
sbHints.AutoHint := HintStr = ''; // only auto hint for interactive controls
end;
// ---------------------------------------------------------------------------
begin
// Get reference to list view triggering this event
LV := Sender as TListView;
// Get list item under mouse cursor if any
Item := LV.GetItemAt(X, Y);
if Item <> LastItem then
begin
// Item has changed: ensure any active hint is cancelled so any new one will
// be displayed
LastItem := Item;
Application.CancelHint;
end;
if Assigned(Item)
and (X > LV.Columns[0].WidthType)
and (Item.SubItems.Count > 0) then
begin
// Mouse cursor is over right column of a valid list item
// .. we display narative as hint only if narrative is wider than column
StrW := LV.StringWidth(Item.SubItems[0]);
if StrW > LV.Columns[1].WidthType - 12 then
SetHint(Item.SubItems[0])
else
SetHint('');
end
else
// Mouse is not over an area containing narative text: no hint
SetHint('');
end;
procedure TMainForm.sbFileNameClick(Sender: TObject);
// Get a file name from uer and display in edit box
begin
if dlgBrowse.Execute then
edFileName.Text := dlgBrowse.FileName;
end;
procedure TMainForm.WMDropFiles(var Msg: TWMDropFiles);
// Catch name of file dropped on window and enter in edit control
var
NumDropped: Integer; // no of files dropped
NameLen: Integer; // length of a file name
FileName: string; // name of a dropped file
begin
inherited;
// Find number of files dropped
NumDropped := DragQueryFile(Msg.Drop, Cardinal(-1), nil, 0);
try
if NumDropped > 0 then
begin
// Find size required for filename buffer (without terminal #0)
NameLen := DragQueryFile(Msg.Drop, 0, nil, 0);
// Get name of dropped file: only interested in first if more than 1
SetLength(FileName, NameLen); // Delphi adds space for terminal #0
DragQueryFile(Msg.Drop, 0, PChar(FileName), NameLen + 1);
// Place name of file in edit control
edFileName.Text := FileName;
end;
finally
// Release handle assoc. with drag/drop
DragFinish(Msg.Drop);
end;
end;
end.

View File

@@ -0,0 +1,12 @@
The VIDemo demo program shows how to use the TPJVersionInfo component to read
the version information from any executable file that contains it.
Run the program then enter the full path to an executable file in the edit box.
Click refresh to display the version information.
If the program contains version information string file information in more than
one language (translation) the "Translation" drop down list will display each
one. Select a translation to display its string file information.
*** NOTE: To compile with Delphi 2007 first delete the .dproj file then load the
project from the .bdsproj file.

View File

@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<PersonalityInfo>
<Option>
<Option Name="Personality">Delphi.Personality</Option>
<Option Name="ProjectType">VCLApplication</Option>
<Option Name="Version">1.0</Option>
<Option Name="GUID">{C6D5C670-1AFC-491B-93F2-BB34F2ABE90D}</Option>
</Option>
</PersonalityInfo>
<Delphi.Personality>
<Source>
<Source Name="MainSource">VIDemo.dpr</Source>
</Source>
<FileVersion>
<FileVersion Name="Version">7.0</FileVersion>
</FileVersion>
<Compiler>
<Compiler Name="A">8</Compiler>
<Compiler Name="B">0</Compiler>
<Compiler Name="C">1</Compiler>
<Compiler Name="D">1</Compiler>
<Compiler Name="E">0</Compiler>
<Compiler Name="F">0</Compiler>
<Compiler Name="G">1</Compiler>
<Compiler Name="H">1</Compiler>
<Compiler Name="I">1</Compiler>
<Compiler Name="J">0</Compiler>
<Compiler Name="K">0</Compiler>
<Compiler Name="L">1</Compiler>
<Compiler Name="M">0</Compiler>
<Compiler Name="N">1</Compiler>
<Compiler Name="O">1</Compiler>
<Compiler Name="P">1</Compiler>
<Compiler Name="Q">0</Compiler>
<Compiler Name="R">0</Compiler>
<Compiler Name="S">0</Compiler>
<Compiler Name="T">0</Compiler>
<Compiler Name="U">0</Compiler>
<Compiler Name="V">1</Compiler>
<Compiler Name="W">0</Compiler>
<Compiler Name="X">1</Compiler>
<Compiler Name="Y">1</Compiler>
<Compiler Name="Z">1</Compiler>
<Compiler Name="ShowHints">True</Compiler>
<Compiler Name="ShowWarnings">True</Compiler>
<Compiler Name="UnitAliases">WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;</Compiler>
<Compiler Name="NamespacePrefix"></Compiler>
<Compiler Name="GenerateDocumentation">False</Compiler>
<Compiler Name="DefaultNamespace"></Compiler>
<Compiler Name="SymbolDeprecated">True</Compiler>
<Compiler Name="SymbolLibrary">True</Compiler>
<Compiler Name="SymbolPlatform">True</Compiler>
<Compiler Name="SymbolExperimental">True</Compiler>
<Compiler Name="UnitLibrary">True</Compiler>
<Compiler Name="UnitPlatform">True</Compiler>
<Compiler Name="UnitDeprecated">True</Compiler>
<Compiler Name="UnitExperimental">True</Compiler>
<Compiler Name="HResultCompat">True</Compiler>
<Compiler Name="HidingMember">True</Compiler>
<Compiler Name="HiddenVirtual">True</Compiler>
<Compiler Name="Garbage">True</Compiler>
<Compiler Name="BoundsError">True</Compiler>
<Compiler Name="ZeroNilCompat">True</Compiler>
<Compiler Name="StringConstTruncated">True</Compiler>
<Compiler Name="ForLoopVarVarPar">True</Compiler>
<Compiler Name="TypedConstVarPar">True</Compiler>
<Compiler Name="AsgToTypedConst">True</Compiler>
<Compiler Name="CaseLabelRange">True</Compiler>
<Compiler Name="ForVariable">True</Compiler>
<Compiler Name="ConstructingAbstract">True</Compiler>
<Compiler Name="ComparisonFalse">True</Compiler>
<Compiler Name="ComparisonTrue">True</Compiler>
<Compiler Name="ComparingSignedUnsigned">True</Compiler>
<Compiler Name="CombiningSignedUnsigned">True</Compiler>
<Compiler Name="UnsupportedConstruct">True</Compiler>
<Compiler Name="FileOpen">True</Compiler>
<Compiler Name="FileOpenUnitSrc">True</Compiler>
<Compiler Name="BadGlobalSymbol">True</Compiler>
<Compiler Name="DuplicateConstructorDestructor">True</Compiler>
<Compiler Name="InvalidDirective">True</Compiler>
<Compiler Name="PackageNoLink">True</Compiler>
<Compiler Name="PackageThreadVar">True</Compiler>
<Compiler Name="ImplicitImport">True</Compiler>
<Compiler Name="HPPEMITIgnored">True</Compiler>
<Compiler Name="NoRetVal">True</Compiler>
<Compiler Name="UseBeforeDef">True</Compiler>
<Compiler Name="ForLoopVarUndef">True</Compiler>
<Compiler Name="UnitNameMismatch">True</Compiler>
<Compiler Name="NoCFGFileFound">True</Compiler>
<Compiler Name="ImplicitVariants">True</Compiler>
<Compiler Name="UnicodeToLocale">True</Compiler>
<Compiler Name="LocaleToUnicode">True</Compiler>
<Compiler Name="ImagebaseMultiple">True</Compiler>
<Compiler Name="SuspiciousTypecast">True</Compiler>
<Compiler Name="PrivatePropAccessor">True</Compiler>
<Compiler Name="UnsafeType">False</Compiler>
<Compiler Name="UnsafeCode">False</Compiler>
<Compiler Name="UnsafeCast">False</Compiler>
<Compiler Name="OptionTruncated">True</Compiler>
<Compiler Name="WideCharReduced">True</Compiler>
<Compiler Name="DuplicatesIgnored">True</Compiler>
<Compiler Name="UnitInitSeq">True</Compiler>
<Compiler Name="LocalPInvoke">True</Compiler>
<Compiler Name="MessageDirective">True</Compiler>
<Compiler Name="CodePage"></Compiler>
</Compiler>
<Linker>
<Linker Name="MapFile">0</Linker>
<Linker Name="OutputObjs">0</Linker>
<Linker Name="GenerateHpps">False</Linker>
<Linker Name="ConsoleApp">1</Linker>
<Linker Name="DebugInfo">False</Linker>
<Linker Name="RemoteSymbols">False</Linker>
<Linker Name="GenerateDRC">False</Linker>
<Linker Name="MinStackSize">16384</Linker>
<Linker Name="MaxStackSize">1048576</Linker>
<Linker Name="ImageBase">4194304</Linker>
<Linker Name="ExeDescription"></Linker>
</Linker>
<Directories>
<Directories Name="OutputDir"></Directories>
<Directories Name="UnitOutputDir"></Directories>
<Directories Name="PackageDLLOutputDir"></Directories>
<Directories Name="PackageDCPOutputDir"></Directories>
<Directories Name="SearchPath"></Directories>
<Directories Name="Packages">vcl;rtl;vclx;indy;vclie;xmlrtl;inetdbbde;inet;inetdbxpress;dbrtl;soaprtl;dsnap;VclSmp;dbexpress;vcldb;dbxcds;inetdb;bdertl;vcldbx;adortl;teeui;teedb;tee;ibxpress;visualclx;visualdbclx;vclactnband;vclshlctrls;DDabLib</Directories>
<Directories Name="Conditionals"></Directories>
<Directories Name="DebugSourceDirs"></Directories>
<Directories Name="UsePackages">False</Directories>
</Directories>
<Parameters>
<Parameters Name="RunParams"></Parameters>
<Parameters Name="HostApplication"></Parameters>
<Parameters Name="Launcher"></Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="DebugCWD"></Parameters>
<Parameters Name="Debug Symbols Search Path"></Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">1033</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
</VersionInfoKeys>
</Delphi.Personality>
</BorlandProject>

View File

@@ -0,0 +1,135 @@
[FileVersion]
Version=7.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
NamespacePrefix=
SymbolDeprecated=1
SymbolLibrary=1
SymbolPlatform=1
UnitLibrary=1
UnitPlatform=1
UnitDeprecated=1
HResultCompat=1
HidingMember=1
HiddenVirtual=1
Garbage=1
BoundsError=1
ZeroNilCompat=1
StringConstTruncated=1
ForLoopVarVarPar=1
TypedConstVarPar=1
AsgToTypedConst=1
CaseLabelRange=1
ForVariable=1
ConstructingAbstract=1
ComparisonFalse=1
ComparisonTrue=1
ComparingSignedUnsigned=1
CombiningSignedUnsigned=1
UnsupportedConstruct=1
FileOpen=1
FileOpenUnitSrc=1
BadGlobalSymbol=1
DuplicateConstructorDestructor=1
InvalidDirective=1
PackageNoLink=1
PackageThreadVar=1
ImplicitImport=1
HPPEMITIgnored=1
NoRetVal=1
UseBeforeDef=1
ForLoopVarUndef=1
UnitNameMismatch=1
NoCFGFileFound=1
MessageDirective=1
ImplicitVariants=1
UnicodeToLocale=1
LocaleToUnicode=1
ImagebaseMultiple=1
SuspiciousTypecast=1
PrivatePropAccessor=1
UnsafeType=0
UnsafeCode=0
UnsafeCast=0
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=vcl;rtl;vclx;indy;vclie;xmlrtl;inetdbbde;inet;inetdbxpress;dbrtl;soaprtl;dsnap;VclSmp;dbexpress;vcldb;dbxcds;inetdb;bdertl;vcldbx;adortl;teeui;teedb;tee;ibxpress;visualclx;visualdbclx;vclactnband;vclshlctrls;DDabLib
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Language]
ActiveLang=
ProjectLang=
RootDir=
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1033
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0

View File

@@ -0,0 +1,40 @@
{
* VIDemo.dpr
*
* Project file for Version Information Component VIDemo demo program.
*
* $Rev: 1118 $
* $Date: 2013-01-14 00:19:04 +0000 (Mon, 14 Jan 2013) $
*
* Any copyright in this file is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
}
program VIDemo;
{$UNDEF Supports_RTLNameSpaces}
{$IFDEF CONDITIONALEXPRESSIONS}
{$IF CompilerVersion >= 15.0} // >= Delphi 7
{$WARN UNSAFE_CODE OFF}
{$IFEND}
{$IF CompilerVersion >= 23.0} // Delphi XE2
{$DEFINE Supports_RTLNameSpaces}
{$IFEND}
{$ENDIF}
uses
{$IFDEF Supports_RTLNameSpaces}
Vcl.Forms,
{$ELSE}
Forms,
{$ENDIF}
FmVIDemo in 'FmVIDemo.pas' {MainForm};
{$R *.RES}
begin
Application.Initialize;
Application.Title := 'Version Info Component Demo';
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.

View File

@@ -0,0 +1,117 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{C4D31A63-BCF8-439E-9127-BEF616691A4C}</ProjectGuid>
<MainSource>VIDemo.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Base</Config>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType>
<FrameworkType>VCL</FrameworkType>
<ProjectVersion>14.4</ProjectVersion>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<DCC_E>false</DCC_E>
<DCC_S>false</DCC_S>
<DCC_N>false</DCC_N>
<DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>2057</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=;CFBundleDisplayName=;CFBundleIdentifier=;CFBundleVersion=;CFBundlePackageType=;CFBundleSignature=;CFBundleAllowMixedLocalizations=;CFBundleExecutable=</VerInfo_Keys>
<DCC_ImageBase>00400000</DCC_ImageBase>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<Icon_MainIcon>VIDemo_Icon.ico</Icon_MainIcon>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<VerInfo_Locale>1033</VerInfo_Locale>
<DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<Icon_MainIcon>VIDemo_Icon.ico</Icon_MainIcon>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="FmVIDemo.pas">
<Form>MainForm</Form>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">VIDemo.dpr</Source>
</Source>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">2057</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName"/>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
<VersionInfoKeys Name="CFBundleName"/>
<VersionInfoKeys Name="CFBundleDisplayName"/>
<VersionInfoKeys Name="CFBundleIdentifier"/>
<VersionInfoKeys Name="CFBundleVersion"/>
<VersionInfoKeys Name="CFBundlePackageType"/>
<VersionInfoKeys Name="CFBundleSignature"/>
<VersionInfoKeys Name="CFBundleAllowMixedLocalizations"/>
<VersionInfoKeys Name="CFBundleExecutable"/>
</VersionInfoKeys>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k170.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp170.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="D:\Software-Installs\Delphi XE3\RAD XE3 Bonus Pack\Mida Converter\MidaBasicDesign170.bpl">File D:\Software-Installs\Delphi XE3\RAD XE3 Bonus Pack\Mida Converter\MidaBasicDesign170.bpl not found</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -0,0 +1,43 @@
object EgForm1: TEgForm1
Left = 192
Top = 107
BorderStyle = bsDialog
Caption = 'Example 1: Translation, char set & language'
ClientHeight = 324
ClientWidth = 599
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Arial'
Font.Style = []
OldCreateOrder = True
Position = poScreenCenter
Scaled = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 15
object ListBox1: TListBox
Left = 0
Top = 0
Width = 599
Height = 277
Align = alTop
ItemHeight = 15
TabOrder = 0
end
object Button3: TButton
Left = 230
Top = 284
Width = 139
Height = 31
Hint = 'Help file must be installed'
Caption = 'View Example'
TabOrder = 1
OnClick = Button3Click
end
object PJVersionInfo1: TPJVersionInfo
Left = 8
Top = 8
end
end

View File

@@ -0,0 +1,95 @@
{
* FmEg1.pas
*
* Form unit that implements example 1 for the Version Information Component
* HelpEgs demo program.
*
* $Rev: 1119 $
* $Date: 2013-01-14 00:39:57 +0000 (Mon, 14 Jan 2013) $
*
* Any copyright in this file is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
}
unit FmEg1;
{$UNDEF Supports_RTLNameSpaces}
{$IFDEF CONDITIONALEXPRESSIONS}
{$IF CompilerVersion >= 15.0} // >= Delphi 7
{$WARN UNSAFE_CODE OFF}
{$IFEND}
{$IF CompilerVersion >= 23.0} // Delphi XE2
{$DEFINE Supports_RTLNameSpaces}
{$IFEND}
{$ENDIF}
interface
uses
// Delphi
{$IFDEF Supports_RTLNameSpaces}
Vcl.Forms, System.Classes, Vcl.Controls, Vcl.StdCtrls,
{$ELSE}
Forms, Classes, Controls, StdCtrls,
{$ENDIF}
// DelphiDabbler component
PJVersionInfo;
type
TEgForm1 = class(TForm)
PJVersionInfo1: TPJVersionInfo;
ListBox1: TListBox;
Button3: TButton;
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
end;
var
EgForm1: TEgForm1;
implementation
uses
// Delphi
{$IFDEF Supports_RTLNameSpaces}
System.SysUtils, Winapi.Windows, Winapi.ShellAPI;
{$ELSE}
SysUtils, Windows, ShellAPI;
{$ENDIF}
{$R *.DFM}
procedure TEgForm1.FormCreate(Sender: TObject);
var
I: Integer;
begin
ListBox1.Clear;
// loop thru all translations
if PJVersionInfo1.HaveInfo then
for I := 0 to Pred(PJVersionInfo1.NumTranslations) do
begin
// make the current translation current
PJVersionInfo1.CurrentTranslation := I;
// add language and char set info to the list box
ListBox1.Items.Add(
Format(
'Language: %s (%0.4X) -- CharSet: %s (%0.4X)',
[PJVersionInfo1.Language, PJVersionInfo1.LanguageCode,
PJVersionInfo1.CharSet, PJVersionInfo1.CharSetCode]
)
);
end
else
ListBox1.Items.Add('NO VERSION INFO');
end;
procedure TEgForm1.Button3Click(Sender: TObject);
// Displays example in help
// this event handler is not included in help example
const
cURL = 'http://delphidabbler.com/url/verinfo-eg1';
begin
ShellExecute(Handle, 'open', cURL, nil, nil, SW_SHOWNORMAL);
end;
end.

View File

@@ -0,0 +1,61 @@
object EgForm2: TEgForm2
Left = 192
Top = 107
BorderStyle = bsDialog
Caption = 'Example 2: String information properties'
ClientHeight = 345
ClientWidth = 449
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Arial'
Font.Style = []
OldCreateOrder = True
Position = poScreenCenter
Scaled = False
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 15
object Memo1: TMemo
Left = 0
Top = 0
Width = 449
Height = 297
Align = alTop
ReadOnly = True
TabOrder = 0
end
object Button1: TButton
Left = 11
Top = 305
Width = 92
Height = 31
Caption = 'Method 1'
TabOrder = 1
OnClick = Button1Click
end
object Button2: TButton
Left = 346
Top = 305
Width = 92
Height = 31
Caption = 'Method 2'
TabOrder = 3
OnClick = Button2Click
end
object Button3: TButton
Left = 155
Top = 305
Width = 139
Height = 31
Hint = 'Help file must be installed'
Caption = 'View Example'
TabOrder = 2
OnClick = Button3Click
end
object PJVersionInfo1: TPJVersionInfo
Left = 8
Top = 8
end
end

176
dd-verinfo/Demo/2/FmEg2.pas Normal file
View File

@@ -0,0 +1,176 @@
{
* FmEg2.pas
*
* Form unit that implements example 2 for the Version Information Component
* HelpEgs demo program.
*
* $Rev: 1119 $
* $Date: 2013-01-14 00:39:57 +0000 (Mon, 14 Jan 2013) $
*
* Any copyright in this file is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
}
unit FmEg2;
{$UNDEF Supports_RTLNameSpaces}
{$IFDEF CONDITIONALEXPRESSIONS}
{$IF CompilerVersion >= 15.0} // >= Delphi 7
{$WARN UNSAFE_CODE OFF}
{$IFEND}
{$IF CompilerVersion >= 23.0} // Delphi XE2
{$DEFINE Supports_RTLNameSpaces}
{$IFEND}
{$ENDIF}
interface
uses
// Delphi
{$IFDEF Supports_RTLNameSpaces}
Vcl.Forms, System.Classes, Vcl.Controls, Vcl.StdCtrls,
{$ELSE}
Forms, Classes, Controls, StdCtrls,
{$ENDIF}
// DelphiDabbler
PJVersionInfo;
type
TEgForm2 = class(TForm)
Memo1: TMemo;
PJVersionInfo1: TPJVersionInfo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button3Click(Sender: TObject);
end;
var
EgForm2: TEgForm2;
implementation
uses
// Delphi
{$IFDEF Supports_RTLNameSpaces}
Vcl.Dialogs, System.SysUtils, Winapi.Windows, Winapi.ShellAPI;
{$ELSE}
Dialogs, SysUtils, Windows, ShellAPI;
{$ENDIF}
{$R *.DFM}
function DirToPath(const Dir: string): string;
// Ensures path end in '\'
begin
if (Dir <> '') and (Dir[Length(Dir)] <> '\') then
Result := Dir + '\'
else
Result := Dir;
end;
function WindowsDir: string;
// Returns Windows directory
begin
SetLength(Result, MAX_PATH);
SetLength(Result, GetWindowsDirectory(PChar(Result), MAX_PATH));
end;
function SystemDir: string;
// Returns Windows System directory
begin
SetLength(Result, MAX_PATH);
SetLength(Result, GetSystemDirectory(PChar(Result), MAX_PATH));
end;
function FindProg(const ExeName: string): string;
// Finds program in Windows or System directory
begin
Result := DirToPath(WindowsDir) + ExeName;
if FileExists(Result) then Exit;
Result := DirToPath(SystemDir) + ExeName;
if not FileExists(Result) then
raise Exception.CreateFmt(
'Can''t find %s in Windows or System folders', [ExeName]
);
end;
procedure TEgForm2.Button1Click(Sender: TObject);
begin
// Get version info for Calc.exe
PJVersionInfo1.FileName := FindProg('Calc.exe');
with Memo1.Lines do
begin
// Clear the memo and write narrative
Clear;
Add('String information block for Windows'
+ ' Calculator (method 1)');
Add('');
// Add string information using dedicated properties
Add('Comments: ' + PJVersionInfo1.Comments);
Add('CompanyName: ' + PJVersionInfo1.CompanyName);
Add('FileDescription: ' + PJVersionInfo1.FileDescription);
Add('FileVersion: ' + PJVersionInfo1.FileVersion);
Add('InternalName: ' + PJVersionInfo1.InternalName);
Add('LegalCopyright: ' + PJVersionInfo1.LegalCopyright);
Add('LegalTrademarks: ' + PJVersionInfo1.LegalTrademarks);
Add('OriginalFileName: ' + PJVersionInfo1.OriginalFileName);
Add('PrivateBuild: ' + PJVersionInfo1.PrivateBuild);
Add('ProductName: ' + PJVersionInfo1.ProductName);
Add('ProductVersion: ' + PJVersionInfo1.ProductVersion);
Add('SpecialBuild: ' + PJVersionInfo1.SpecialBuild);
end;
end;
procedure TEgForm2.Button2Click(Sender: TObject);
// ---------------------------------------------------------------------------
procedure AddStrInfo(StrName: string);
// Add string info to memo by name
begin
Memo1.Lines.Add(StrName + ': ' + PJVersionInfo1.StringFileInfo[StrName]);
end;
// ---------------------------------------------------------------------------
begin
// Get string info for Notepad.exe
PJVersionInfo1.FileName := FindProg('Notepad.exe');
// Clear memo and write narrative
Memo1.Clear;
Memo1.Lines.Add('String information block for Windows'
+ ' NotePad (method 2)');
Memo1.Lines.Add('');
// Add string info using string info names
AddStrInfo('Comments');
AddStrInfo('CompanyName');
AddStrInfo('FileDescription');
AddStrInfo('FileVersion');
AddStrInfo('InternalName');
AddStrInfo('LegalCopyright');
AddStrInfo('LegalTrademarks');
AddStrInfo('OriginalFileName');
AddStrInfo('PrivateBuild');
AddStrInfo('ProductName');
AddStrInfo('ProductVersion');
AddStrInfo('SpecialBuild');
end;
procedure TEgForm2.FormShow(Sender: TObject);
// Clears memo when form is displayed
begin
Memo1.Clear;
end;
procedure TEgForm2.Button3Click(Sender: TObject);
// Displays example in help
// this event handler is not included in help example
const
cURL = 'http://delphidabbler.com/url/verinfo-eg2';
begin
ShellExecute(Handle, 'open', cURL, nil, nil, SW_SHOWNORMAL);
end;
end.

View File

@@ -0,0 +1,44 @@
object EgForm3: TEgForm3
Left = 192
Top = 108
BorderStyle = bsDialog
Caption = 'Example 3: Fixed file information properties'
ClientHeight = 401
ClientWidth = 519
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Arial'
Font.Style = []
OldCreateOrder = True
Position = poScreenCenter
Scaled = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 15
object Memo1: TMemo
Left = 0
Top = 0
Width = 519
Height = 356
Align = alTop
ReadOnly = True
ScrollBars = ssVertical
TabOrder = 0
end
object Button3: TButton
Left = 190
Top = 363
Width = 139
Height = 31
Hint = 'Help file must be installed'
Caption = 'View Example'
TabOrder = 1
OnClick = Button3Click
end
object PJVersionInfo1: TPJVersionInfo
Left = 8
Top = 8
end
end

199
dd-verinfo/Demo/2/FmEg3.pas Normal file
View File

@@ -0,0 +1,199 @@
{
* FmEg3.pas
*
* Form unit that implements example 3 for the Version Information Component
* HelpEgs demo program.
*
* $Rev: 1119 $
* $Date: 2013-01-14 00:39:57 +0000 (Mon, 14 Jan 2013) $
*
* Any copyright in this file is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
}
unit FmEg3;
{$UNDEF Supports_RTLNameSpaces}
{$IFDEF CONDITIONALEXPRESSIONS}
{$IF CompilerVersion >= 15.0} // >= Delphi 7
{$WARN UNSAFE_CODE OFF}
{$IFEND}
{$IF CompilerVersion >= 23.0} // Delphi XE2
{$DEFINE Supports_RTLNameSpaces}
{$IFEND}
{$ENDIF}
interface
uses
// Delphi
{$IFDEF Supports_RTLNameSpaces}
Vcl.Forms, System.Classes, Vcl.Controls, Vcl.StdCtrls,
{$ELSE}
Forms, Classes, Controls, StdCtrls,
{$ENDIF}
// DelphiDabbler component
PJVersionInfo;
type
TEgForm3 = class(TForm)
Memo1: TMemo;
PJVersionInfo1: TPJVersionInfo;
Button3: TButton;
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
end;
var
EgForm3: TEgForm3;
implementation
uses
// Delphi
{$IFDEF Supports_RTLNameSpaces}
System.SysUtils, Winapi.Windows, Winapi.ShellAPI;
{$ELSE}
SysUtils, Windows, ShellAPI;
{$ENDIF}
{$R *.DFM}
type
TTableEntry = record
Code: DWORD;
Desc: string;
end;
const
cFileType: array[0..6] of TTableEntry =
(
(Code: VFT_APP; Desc: 'Application'),
(Code: VFT_DLL; Desc: 'DLL'),
(Code: VFT_DRV; Desc: 'Device driver'),
(Code: VFT_FONT; Desc: 'Font'),
(Code: VFT_STATIC_LIB; Desc: 'Static link library'),
(Code: VFT_VXD; Desc: 'Virtual device driver'),
(Code: VFT_UNKNOWN; Desc: 'Unknown')
);
cFileOSBase: array[0..4] of TTableEntry =
(
( Code: VOS_NT; Desc: 'Windows NT' ),
( Code: VOS_DOS; Desc: 'MS-DOS' ),
( Code: VOS_OS232; Desc: 'OS2 32 bit' ),
( Code: VOS_OS216; Desc: 'OS2 16 bit' ),
( Code: VOS_UNKNOWN; Desc: 'Any' )
);
cFileOSTarget: array[0..4] of TTableEntry =
(
( Code: VOS__WINDOWS32; Desc: '32 bit Windows' ),
( Code: VOS__WINDOWS16; Desc: 'Windows 3.x' ),
( Code: VOS__PM32; Desc: 'Presentation Manager 32' ),
( Code: VOS__PM16; Desc: 'Presentation Manager 16' ),
( Code: VOS__BASE; Desc: 'Unknown' )
);
function CodeToDesc(Code: DWORD; Table: array of TTableEntry): string;
var
I: Integer;
begin
Result := '';
for I := Low(Table) to High(Table) do
if Table[I].Code = Code then
begin
Result := Table[I].Desc;
Break;
end;
end;
function FileOSDesc(const OS: DWORD): string;
// describe OS
var
Target, Base: DWORD;
begin
// get target and base OS
Target := OS and $0000FFFF;
Base := OS and $FFFF0000;
// build description
if Base = VOS_UNKNOWN then
Result := CodeToDesc(Target, cFileOSTarget)
else if Target = VOS__BASE then
Result := CodeToDesc(Base, cFileOSBase)
else
Result := Format('%s on %s',
[CodeToDesc(Target, cFileOSTarget),
CodeToDesc(Base, cFileOSBase)]);
end;
function FileFlagsToStr(const Flags: DWORD): string;
// build string of file flags
const
cFileFlags: array[0..5] of TTableEntry =
(
(Code: VS_FF_DEBUG; Desc: 'Debug'),
(Code: VS_FF_PRERELEASE; Desc: 'Pre-release'),
(Code: VS_FF_PATCHED; Desc: 'Patched'),
(Code: VS_FF_PRIVATEBUILD; Desc: 'Private build'),
(Code: VS_FF_INFOINFERRED; Desc: 'Inferred'),
(Code: VS_FF_SPECIALBUILD; Desc: 'Special build') );
var
I: Integer;
begin
Result := '';
for I := Low(cFileFlags) to High(cFileFlags) do
if Flags and cFileFlags[I].Code = cFileFlags[I].Code then
Result := Result + #13#10' ' + cFileFlags[I].Desc
end;
function VerToStr(Ver: TPJVersionNumber): string;
// return ver number as string
begin
Result := Format('%d.%d.%d.%d', [Ver.V1, Ver.V2, Ver.V3, Ver.V4]);
end;
procedure TEgForm3.FormCreate(Sender: TObject);
begin
// clear memo
Memo1.Lines.Clear;
// check if we have version info
if PJVersionInfo1.HaveInfo then
// we have version info: display fixed file info
with Memo1.Lines do
begin
Clear;
Add('File Version:'#13#10' '
+ VerToStr(PJVersionInfo1.FileVersionNumber));
Add('Product Version:'#13#10' '
+ VerToStr(PJVersionInfo1.ProductVersionNumber));
Add('File Flags Mask: '
+ FileFlagsToStr(PJVersionInfo1.FileFlagsMask));
Add('File Flags: '
+ FileFlagsToStr(PJVersionInfo1.FileFlags));
Add('File Type:'#13#10' '
+ CodeToDesc(PJVersionInfo1.FileType, cFileType));
Add('File sub type:');
case PJVersionInfo1.FileType of
VFT_FONT, VFT_DRV, VFT_VXD:
Add(Format(' %0.8X', [PJVersionInfo1.FileSubType]));
else Add(' None');
end;
Add('File OS:'#13#10' '
+ FileOSDesc(PJVersionInfo1.FileOS));
end
else
Memo1.Lines.Add('NO VERSION INFO');
end;
procedure TEgForm3.Button3Click(Sender: TObject);
// Displays example in help
// this event handler is not included in help example
const
cURL = 'http://delphidabbler.com/url/verinfo-eg3';
begin
ShellExecute(Handle, 'open', cURL, nil, nil, SW_SHOWNORMAL);
end;
end.

View File

@@ -0,0 +1,44 @@
object EgForm4: TEgForm4
Left = 192
Top = 108
BorderStyle = bsDialog
Caption = 'Example 4: FixedFileInfo property'
ClientHeight = 409
ClientWidth = 519
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Arial'
Font.Style = []
OldCreateOrder = True
Position = poScreenCenter
Scaled = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 15
object Memo1: TMemo
Left = 0
Top = 0
Width = 519
Height = 366
Align = alTop
ReadOnly = True
ScrollBars = ssVertical
TabOrder = 0
end
object Button3: TButton
Left = 190
Top = 372
Width = 139
Height = 31
Hint = 'Help file must be installed'
Caption = 'View Example'
TabOrder = 1
OnClick = Button3Click
end
object PJVersionInfo1: TPJVersionInfo
Left = 8
Top = 8
end
end

204
dd-verinfo/Demo/2/FmEg4.pas Normal file
View File

@@ -0,0 +1,204 @@
{
* FmEg4.pas
*
* Form unit that implements example 4 for the Version Information Component
* HelpEgs demo program.
*
* $Rev: 1119 $
* $Date: 2013-01-14 00:39:57 +0000 (Mon, 14 Jan 2013) $
*
* Any copyright in this file is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
}
unit FmEg4;
{$UNDEF Supports_RTLNameSpaces}
{$IFDEF CONDITIONALEXPRESSIONS}
{$IF CompilerVersion >= 15.0} // >= Delphi 7
{$WARN UNSAFE_CODE OFF}
{$IFEND}
{$IF CompilerVersion >= 23.0} // Delphi XE2
{$DEFINE Supports_RTLNameSpaces}
{$IFEND}
{$ENDIF}
interface
uses
// Delphi
{$IFDEF Supports_RTLNameSpaces}
Vcl.Forms, System.Classes, Vcl.Controls, Vcl.StdCtrls,
{$ELSE}
Forms, Classes, Controls, StdCtrls,
{$ENDIF}
// DelphiDabbler component
PJVersionInfo;
type
TEgForm4 = class(TForm)
Memo1: TMemo;
PJVersionInfo1: TPJVersionInfo;
Button3: TButton;
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
end;
var
EgForm4: TEgForm4;
implementation
uses
// Delphi
{$IFDEF Supports_RTLNameSpaces}
Winapi.Windows, System.SysUtils, Winapi.ShellAPI;
{$ELSE}
Windows, SysUtils, ShellAPI;
{$ENDIF}
{$R *.DFM}
type
TTableEntry = record
Code: DWORD;
Desc: string;
end;
const
cFileType: array[0..6] of TTableEntry =
(
(Code: VFT_APP; Desc: 'Application'),
(Code: VFT_DLL; Desc: 'DLL'),
(Code: VFT_DRV; Desc: 'Device driver'),
(Code: VFT_FONT; Desc: 'Font'),
(Code: VFT_STATIC_LIB; Desc: 'Static link library'),
(Code: VFT_VXD; Desc: 'Virtual device driver'),
(Code: VFT_UNKNOWN; Desc: 'Unknown')
);
cFileOSBase: array[0..4] of TTableEntry =
(
( Code: VOS_NT; Desc: 'Windows NT' ),
( Code: VOS_DOS; Desc: 'MS-DOS' ),
( Code: VOS_OS232; Desc: 'OS2 32 bit' ),
( Code: VOS_OS216; Desc: 'OS2 16 bit' ),
( Code: VOS_UNKNOWN; Desc: 'Any' )
);
cFileOSTarget: array[0..4] of TTableEntry =
(
( Code: VOS__WINDOWS32; Desc: '32 bit Windows' ),
( Code: VOS__WINDOWS16; Desc: 'Windows 3.x' ),
( Code: VOS__PM32; Desc: 'Presentation Manager 32' ),
( Code: VOS__PM16; Desc: 'Presentation Manager 16' ),
( Code: VOS__BASE; Desc: 'Unknown' )
);
function CodeToDesc(Code: DWORD; Table: array of TTableEntry): string;
var
I: Integer;
begin
Result := '';
for I := Low(Table) to High(Table) do
if Table[I].Code = Code then
begin
Result := Table[I].Desc;
Break;
end;
end;
function FileOSDesc(const OS: DWORD): string;
// describe OS
var
Target, Base: DWORD;
begin
// get target and base OS
Target := OS and $0000FFFF;
Base := OS and $FFFF0000;
// build description
if Base = VOS_UNKNOWN then
Result := CodeToDesc(Target, cFileOSTarget)
else if Target = VOS__BASE then
Result := CodeToDesc(Base, cFileOSBase)
else
Result := Format('%s on %s',
[CodeToDesc(Target, cFileOSTarget),
CodeToDesc(Base, cFileOSBase)]);
end;
function FileFlagsToStr(const Flags: DWORD): string;
// build string of file flags
const
cFileFlags: array[0..5] of TTableEntry =
(
(Code: VS_FF_DEBUG; Desc: 'Debug'),
(Code: VS_FF_PRERELEASE; Desc: 'Pre-release'),
(Code: VS_FF_PATCHED; Desc: 'Patched'),
(Code: VS_FF_PRIVATEBUILD; Desc: 'Private build'),
(Code: VS_FF_INFOINFERRED; Desc: 'Inferred'),
(Code: VS_FF_SPECIALBUILD; Desc: 'Special build') );
var
I: Integer;
begin
Result := '';
for I := Low(cFileFlags) to High(cFileFlags) do
if Flags and cFileFlags[I].Code = cFileFlags[I].Code then
Result := Result + #13#10' ' + cFileFlags[I].Desc
end;
function VerToStr(MS, LS: DWORD): string;
// return ver number as string
begin
Result := Format('%d.%d.%d.%d',
[HiWord(MS), LoWord(MS), HiWord(LS), LoWord(LS)]);
end;
procedure TEgForm4.FormCreate(Sender: TObject);
var
FFI: TVSFixedFileInfo;
begin
// clear memo
Memo1.Lines.Clear;
// check if we have version info
if PJVersionInfo1.HaveInfo then
begin
// we have version info: display fixed file info
FFI := PJVersionInfo1.FixedFileInfo;
with Memo1.Lines do
begin
Clear;
Add('File Version:'#13#10' '
+ VerToStr(FFI.dwFileVersionMS, FFI.dwFileVersionLS));
Add('Product Version:'#13#10' '
+ VerToStr(FFI.dwProductVersionMS, FFI.dwProductVersionLS));
Add('File Flags Mask: '
+ FileFlagsToStr(FFI.dwFileFlagsMask));
Add('File Flags: '
+ FileFlagsToStr(FFI.dwFileFlags));
Add('File Type:'#13#10' '
+ CodeToDesc(FFI.dwFileType, cFileType));
Add('File sub type:');
case FFI.dwFileType of
VFT_FONT, VFT_DRV, VFT_VXD:
Add(Format(' %0.8X', [FFI.dwFileSubType]));
else Add(' None');
end;
Add('File OS:'#13#10' '
+ FileOSDesc(FFI.dwFileOS));
end
end
else
Memo1.Lines.Add('NO VERSION INFO');
end;
procedure TEgForm4.Button3Click(Sender: TObject);
// Displays example in help
// this event handler is not included in help example
const
cURL = 'http://delphidabbler.com/url/verinfo-eg4';
begin
ShellExecute(Handle, 'open', cURL, nil, nil, SW_SHOWNORMAL);
end;
end.

View File

@@ -0,0 +1,63 @@
object MainForm: TMainForm
Left = 293
Top = 113
BorderStyle = bsDialog
ClientHeight = 194
ClientWidth = 297
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Arial'
Font.Style = []
OldCreateOrder = True
Position = poScreenCenter
Scaled = False
OnCreate = FormCreate
OnDestroy = FormDestroy
PixelsPerInch = 96
TextHeight = 15
object lblDesc: TLabel
Left = 10
Top = 10
Width = 261
Height = 15
Caption = 'Click the button to display the required example.'
end
object btnEg1: TButton
Left = 10
Top = 39
Width = 277
Height = 31
Caption = 'Example 1: Translation, char set && language'
TabOrder = 0
OnClick = btnEg1Click
end
object btnEg2: TButton
Left = 10
Top = 79
Width = 277
Height = 31
Caption = 'Example 2: String information properties'
TabOrder = 1
OnClick = btnEg2Click
end
object btnEg3: TButton
Left = 10
Top = 118
Width = 277
Height = 31
Caption = 'Example 3: Fixed file information properties'
TabOrder = 2
OnClick = btnEg3Click
end
object btnEg4: TButton
Left = 10
Top = 158
Width = 277
Height = 30
Caption = 'Example 4: FixedFileInfo property'
TabOrder = 3
OnClick = btnEg4Click
end
end

View File

@@ -0,0 +1,101 @@
{
* FmMain.pas
*
* Main form for Version Information Component HelpEgs demo program.
*
* $Rev: 1123 $
* $Date: 2013-01-14 01:26:28 +0000 (Mon, 14 Jan 2013) $
*
* Any copyright in this file is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
}
unit FmMain;
{$UNDEF Supports_RTLNameSpaces}
{$IFDEF CONDITIONALEXPRESSIONS}
{$IF CompilerVersion >= 15.0} // >= Delphi 7
{$WARN UNSAFE_CODE OFF}
{$IFEND}
{$IF CompilerVersion >= 23.0} // Delphi XE2
{$DEFINE Supports_RTLNameSpaces}
{$IFEND}
{$ENDIF}
interface
uses
// Delphi
{$IFNDEF Supports_RTLNameSpaces}
Forms, Classes, Controls, StdCtrls;
{$ELSE}
Vcl.Forms, System.Classes, Vcl.Controls, Vcl.StdCtrls;
{$ENDIF}
type
TMainForm = class(TForm)
btnEg1: TButton;
btnEg2: TButton;
btnEg3: TButton;
btnEg4: TButton;
lblDesc: TLabel;
procedure btnEg1Click(Sender: TObject);
procedure btnEg2Click(Sender: TObject);
procedure btnEg3Click(Sender: TObject);
procedure btnEg4Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
end;
var
MainForm: TMainForm;
implementation
uses
// Delphi
{$IFDEF Supports_RTLNameSpaces}
Winapi.Windows,
{$ELSE}
Windows,
{$ENDIF}
// Project
FmEg1, FmEg2, FmEg3, FmEg4;
{$R *.DFM}
procedure TMainForm.btnEg1Click(Sender: TObject);
// Display example 1 dialog box
begin
EgForm1.ShowModal;
end;
procedure TMainForm.btnEg2Click(Sender: TObject);
// Display example 2 dialog box
begin
EgForm2.ShowModal;
end;
procedure TMainForm.btnEg3Click(Sender: TObject);
// Display example 3 dialog box
begin
EgForm3.ShowModal;
end;
procedure TMainForm.btnEg4Click(Sender: TObject);
// Display example 4 dialog box
begin
EgForm4.ShowModal;
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
Caption := Application.Title;
end;
procedure TMainForm.FormDestroy(Sender: TObject);
begin
WinHelp(Handle, 'PJVersionInfo.hlp', HELP_QUIT, 0);
end;
end.

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<PersonalityInfo>
<Option>
<Option Name="Personality">Delphi.Personality</Option>
<Option Name="ProjectType">VCLApplication</Option>
<Option Name="Version">1.0</Option>
<Option Name="GUID">{34FEC23F-116A-4111-9A4D-3405A020461D}</Option>
</Option>
</PersonalityInfo>
<Delphi.Personality>
<Source>
<Source Name="MainSource">HelpEgs.dpr</Source>
</Source>
<FileVersion>
<FileVersion Name="Version">7.0</FileVersion>
</FileVersion>
<Compiler>
<Compiler Name="A">8</Compiler>
<Compiler Name="B">0</Compiler>
<Compiler Name="C">1</Compiler>
<Compiler Name="D">1</Compiler>
<Compiler Name="E">0</Compiler>
<Compiler Name="F">0</Compiler>
<Compiler Name="G">1</Compiler>
<Compiler Name="H">1</Compiler>
<Compiler Name="I">1</Compiler>
<Compiler Name="J">0</Compiler>
<Compiler Name="K">0</Compiler>
<Compiler Name="L">1</Compiler>
<Compiler Name="M">0</Compiler>
<Compiler Name="N">1</Compiler>
<Compiler Name="O">1</Compiler>
<Compiler Name="P">1</Compiler>
<Compiler Name="Q">0</Compiler>
<Compiler Name="R">0</Compiler>
<Compiler Name="S">0</Compiler>
<Compiler Name="T">0</Compiler>
<Compiler Name="U">0</Compiler>
<Compiler Name="V">1</Compiler>
<Compiler Name="W">0</Compiler>
<Compiler Name="X">1</Compiler>
<Compiler Name="Y">1</Compiler>
<Compiler Name="Z">1</Compiler>
<Compiler Name="ShowHints">True</Compiler>
<Compiler Name="ShowWarnings">True</Compiler>
<Compiler Name="UnitAliases"></Compiler>
<Compiler Name="NamespacePrefix"></Compiler>
<Compiler Name="GenerateDocumentation">False</Compiler>
<Compiler Name="DefaultNamespace"></Compiler>
<Compiler Name="SymbolDeprecated">True</Compiler>
<Compiler Name="SymbolLibrary">True</Compiler>
<Compiler Name="SymbolPlatform">True</Compiler>
<Compiler Name="SymbolExperimental">True</Compiler>
<Compiler Name="UnitLibrary">True</Compiler>
<Compiler Name="UnitPlatform">True</Compiler>
<Compiler Name="UnitDeprecated">True</Compiler>
<Compiler Name="UnitExperimental">True</Compiler>
<Compiler Name="HResultCompat">True</Compiler>
<Compiler Name="HidingMember">True</Compiler>
<Compiler Name="HiddenVirtual">True</Compiler>
<Compiler Name="Garbage">True</Compiler>
<Compiler Name="BoundsError">True</Compiler>
<Compiler Name="ZeroNilCompat">True</Compiler>
<Compiler Name="StringConstTruncated">True</Compiler>
<Compiler Name="ForLoopVarVarPar">True</Compiler>
<Compiler Name="TypedConstVarPar">True</Compiler>
<Compiler Name="AsgToTypedConst">True</Compiler>
<Compiler Name="CaseLabelRange">True</Compiler>
<Compiler Name="ForVariable">True</Compiler>
<Compiler Name="ConstructingAbstract">True</Compiler>
<Compiler Name="ComparisonFalse">True</Compiler>
<Compiler Name="ComparisonTrue">True</Compiler>
<Compiler Name="ComparingSignedUnsigned">True</Compiler>
<Compiler Name="CombiningSignedUnsigned">True</Compiler>
<Compiler Name="UnsupportedConstruct">True</Compiler>
<Compiler Name="FileOpen">True</Compiler>
<Compiler Name="FileOpenUnitSrc">True</Compiler>
<Compiler Name="BadGlobalSymbol">True</Compiler>
<Compiler Name="DuplicateConstructorDestructor">True</Compiler>
<Compiler Name="InvalidDirective">True</Compiler>
<Compiler Name="PackageNoLink">True</Compiler>
<Compiler Name="PackageThreadVar">True</Compiler>
<Compiler Name="ImplicitImport">True</Compiler>
<Compiler Name="HPPEMITIgnored">True</Compiler>
<Compiler Name="NoRetVal">True</Compiler>
<Compiler Name="UseBeforeDef">True</Compiler>
<Compiler Name="ForLoopVarUndef">True</Compiler>
<Compiler Name="UnitNameMismatch">True</Compiler>
<Compiler Name="NoCFGFileFound">True</Compiler>
<Compiler Name="ImplicitVariants">True</Compiler>
<Compiler Name="UnicodeToLocale">True</Compiler>
<Compiler Name="LocaleToUnicode">True</Compiler>
<Compiler Name="ImagebaseMultiple">True</Compiler>
<Compiler Name="SuspiciousTypecast">True</Compiler>
<Compiler Name="PrivatePropAccessor">True</Compiler>
<Compiler Name="UnsafeType">False</Compiler>
<Compiler Name="UnsafeCode">False</Compiler>
<Compiler Name="UnsafeCast">False</Compiler>
<Compiler Name="OptionTruncated">True</Compiler>
<Compiler Name="WideCharReduced">True</Compiler>
<Compiler Name="DuplicatesIgnored">True</Compiler>
<Compiler Name="UnitInitSeq">True</Compiler>
<Compiler Name="LocalPInvoke">True</Compiler>
<Compiler Name="MessageDirective">True</Compiler>
<Compiler Name="CodePage"></Compiler>
</Compiler>
<Linker>
<Linker Name="MapFile">0</Linker>
<Linker Name="OutputObjs">0</Linker>
<Linker Name="GenerateHpps">False</Linker>
<Linker Name="ConsoleApp">1</Linker>
<Linker Name="DebugInfo">False</Linker>
<Linker Name="RemoteSymbols">False</Linker>
<Linker Name="GenerateDRC">False</Linker>
<Linker Name="MinStackSize">16384</Linker>
<Linker Name="MaxStackSize">1048576</Linker>
<Linker Name="ImageBase">4194304</Linker>
<Linker Name="ExeDescription"></Linker>
</Linker>
<Directories>
<Directories Name="OutputDir"></Directories>
<Directories Name="UnitOutputDir"></Directories>
<Directories Name="PackageDLLOutputDir"></Directories>
<Directories Name="PackageDCPOutputDir"></Directories>
<Directories Name="SearchPath"></Directories>
<Directories Name="Packages"></Directories>
<Directories Name="Conditionals"></Directories>
<Directories Name="DebugSourceDirs"></Directories>
<Directories Name="UsePackages">False</Directories>
</Directories>
<Parameters>
<Parameters Name="RunParams"></Parameters>
<Parameters Name="HostApplication"></Parameters>
<Parameters Name="Launcher"></Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="DebugCWD"></Parameters>
<Parameters Name="Debug Symbols Search Path"></Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">2057</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
</VersionInfoKeys>
</Delphi.Personality>
</BorlandProject>

View File

@@ -0,0 +1,136 @@
[FileVersion]
Version=7.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=
NamespacePrefix=
SymbolDeprecated=1
SymbolLibrary=1
SymbolPlatform=1
UnitLibrary=1
UnitPlatform=1
UnitDeprecated=1
HResultCompat=1
HidingMember=1
HiddenVirtual=1
Garbage=1
BoundsError=1
ZeroNilCompat=1
StringConstTruncated=1
ForLoopVarVarPar=1
TypedConstVarPar=1
AsgToTypedConst=1
CaseLabelRange=1
ForVariable=1
ConstructingAbstract=1
ComparisonFalse=1
ComparisonTrue=1
ComparingSignedUnsigned=1
CombiningSignedUnsigned=1
UnsupportedConstruct=1
FileOpen=1
FileOpenUnitSrc=1
BadGlobalSymbol=1
DuplicateConstructorDestructor=1
InvalidDirective=1
PackageNoLink=1
PackageThreadVar=1
ImplicitImport=1
HPPEMITIgnored=1
NoRetVal=1
UseBeforeDef=1
ForLoopVarUndef=1
UnitNameMismatch=1
NoCFGFileFound=1
MessageDirective=1
ImplicitVariants=1
UnicodeToLocale=1
LocaleToUnicode=1
ImagebaseMultiple=1
SuspiciousTypecast=1
PrivatePropAccessor=1
UnsafeType=0
UnsafeCode=0
UnsafeCast=0
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Language]
ActiveLang=
ProjectLang=
RootDir=
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=2057
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=

View File

@@ -0,0 +1,49 @@
{
* HelpEgs.dpr
*
* Project file for Version Information Component HelpEgs demo program.
*
* $Rev: 1119 $
* $Date: 2013-01-14 00:39:57 +0000 (Mon, 14 Jan 2013) $
*
* Any copyright in this file is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
}
program HelpEgs;
{$UNDEF Supports_RTLNameSpaces}
{$IFDEF CONDITIONALEXPRESSIONS}
{$IF CompilerVersion >= 15.0} // >= Delphi 7
{$WARN UNSAFE_CODE OFF}
{$IFEND}
{$IF CompilerVersion >= 23.0} // Delphi XE2
{$DEFINE Supports_RTLNameSpaces}
{$IFEND}
{$ENDIF}
uses
{$IFDEF Supports_RTLNameSpaces}
Vcl.Forms,
{$ELSE}
Forms,
{$ENDIF}
FmMain in 'FmMain.pas' {MainForm},
FmEg1 in 'FmEg1.pas' {EgForm1},
FmEg2 in 'FmEg2.pas' {EgForm2},
FmEg3 in 'FmEg3.pas' {EgForm3},
FmEg4 in 'FmEg4.pas' {EgForm4};
{$R *.RES}
{$R MultiVer.res}
begin
Application.Title := 'TPJVersionInfo Help Examples';
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.CreateForm(TEgForm1, EgForm1);
Application.CreateForm(TEgForm2, EgForm2);
Application.CreateForm(TEgForm3, EgForm3);
Application.CreateForm(TEgForm4, EgForm4);
Application.Run;
end.

View File

@@ -0,0 +1,159 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{16969235-37DD-4A02-BE4C-310882F9046C}</ProjectGuid>
<MainSource>HelpEgs.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType>
<FrameworkType>VCL</FrameworkType>
<ProjectVersion>14.4</ProjectVersion>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_S>false</DCC_S>
<DCC_ImageBase>00400000</DCC_ImageBase>
<DCC_N>false</DCC_N>
<VerInfo_Locale>2057</VerInfo_Locale>
<DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=;CFBundleDisplayName=;CFBundleIdentifier=;CFBundleVersion=;CFBundlePackageType=;CFBundleSignature=;CFBundleAllowMixedLocalizations=;CFBundleExecutable=</VerInfo_Keys>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<DCC_E>false</DCC_E>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>false</DCC_DebugInformation>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_Optimize>false</DCC_Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<Icon_MainIcon>HelpEgs_Icon.ico</Icon_MainIcon>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="FmMain.pas">
<Form>MainForm</Form>
</DCCReference>
<DCCReference Include="FmEg1.pas">
<Form>EgForm1</Form>
</DCCReference>
<DCCReference Include="FmEg2.pas">
<Form>EgForm2</Form>
</DCCReference>
<DCCReference Include="FmEg3.pas">
<Form>EgForm3</Form>
</DCCReference>
<DCCReference Include="FmEg4.pas">
<Form>EgForm4</Form>
</DCCReference>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">HelpEgs.dpr</Source>
</Source>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">2057</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName"/>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
<VersionInfoKeys Name="CFBundleName"/>
<VersionInfoKeys Name="CFBundleDisplayName"/>
<VersionInfoKeys Name="CFBundleIdentifier"/>
<VersionInfoKeys Name="CFBundleVersion"/>
<VersionInfoKeys Name="CFBundlePackageType"/>
<VersionInfoKeys Name="CFBundleSignature"/>
<VersionInfoKeys Name="CFBundleAllowMixedLocalizations"/>
<VersionInfoKeys Name="CFBundleExecutable"/>
</VersionInfoKeys>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k170.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp170.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="D:\Software-Installs\Delphi XE3\RAD XE3 Bonus Pack\Mida Converter\MidaBasicDesign170.bpl">File D:\Software-Installs\Delphi XE3\RAD XE3 Bonus Pack\Mida Converter\MidaBasicDesign170.bpl not found</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -0,0 +1,57 @@
/*
* MultiVer.rc
*
* Resource file containing version information with more than one translation
* for use in the the Version Information Component HelpEgs demo program.
*
* $Rev: 1109 $
* $Date: 2013-01-13 23:19:20 +0000 (Sun, 13 Jan 2013) $
*
* Any copyright in this file is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
#define VERINFO 1
VERINFO VERSIONINFO
FILEVERSION 1, 2, 3, 4
PRODUCTVERSION 1, 0, 123, 2001
FILEFLAGSMASK 0x3F
FILEFLAGS VS_FF_DEBUG + VS_FF_PRIVATEBUILD
FILEOS VOS_DOS_WINDOWS32
FILETYPE VFT_APP
{
BLOCK "StringFileInfo"
{
BLOCK "080904E4"
{
VALUE "Comments", "This is the English English realisation.\000"
VALUE "CompanyName", "DelphiDabbler.com\000"
VALUE "FileDescription", "A demo application showing multi-lingual version info resources.\000"
VALUE "FileVersion", "1.0\000"
VALUE "InternalName", "MultiLingDemo\000"
VALUE "LegalCopyright", "No copyright\000"
VALUE "OriginalFileName", "MultiLingDemo.exe\000"
VALUE "PrivateBuild", "This is a UK private build\000"
VALUE "ProductName", "Multilingual Demo App\000"
VALUE "ProductVersion", "1.0\000"
}
BLOCK "040904B0"
{
VALUE "Comments", "This is the American English realization.\000"
VALUE "CompanyName", "DelphiDabbler.com\000"
VALUE "FileDescription", "A demo application showing multi-lingual version info resources.\000"
VALUE "FileVersion", "1.0\000"
VALUE "InternalName", "MultiLingDemo\000"
VALUE "LegalCopyright", "No copyright\000"
VALUE "OriginalFileName", "MultiLingDemo.exe\000"
VALUE "PrivateBuild", "This is a US private build\000"
VALUE "ProductName", "Multilingual Demo App\000"
VALUE "ProductVersion", "1.0\000"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0809, 1252, 0x0409, 1200
}
}

View File

@@ -0,0 +1,11 @@
The HelpEgs demo program implements the examples from both the Version
Information Component's help file and online documentation.
The main window displays a button for each example. Click the required button to
run an example and display the results.
Each example display its own dialogue box that includes a link to the related
online example.
*** NOTE: To compile with Delphi 2007 first delete the .dproj file then load the
project from the .bdsproj file.

View File

@@ -0,0 +1,3 @@
[InternetShortcut]
URL=http://www.delphidabbler.com/url/verinfo-docs

373
dd-verinfo/MPL-2.txt Normal file
View File

@@ -0,0 +1,373 @@
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

View File

@@ -0,0 +1,94 @@
charset
charset_property
charsetcode
charsetcode_property
comments
comments_property
companyname
companyname_property
currenttranslation
currenttranslation_property
filedescription
filedescription_property
fileflags
fileflags_property
fileflagsmask
fileflagsmask_property
filename
filename_property
fileos
fileos_property
filesubtype
filesubtype_property
filetype
filetype_property
fileversion
fileversion_property
fileversionnumber
fileversionnumber_property
fixedfileinfo
fixedfileinfo_property
haveinfo
haveinfo_property
internalname
internalname_property
language
language_property
languagecode
languagecode_property
legalcopyright
legalcopyright_property
legaltrademarks
legaltrademarks_property
numtranslations
numtranslations_property
originalfilename
originalfilename_property
privatebuild
privatebuild_property
productname
productname_property
productversion
productversion_property
productversionnumber
productversionnumber_property
specialbuild
specialbuild_property
stringfileinfo
stringfileinfo_property
tpjversioninfo
tpjversioninfo_charset
tpjversioninfo_charsetcode
tpjversioninfo_comments
tpjversioninfo_companyname
tpjversioninfo_currenttranslation
tpjversioninfo_example1
tpjversioninfo_example2
tpjversioninfo_example3
tpjversioninfo_example4
tpjversioninfo_filedescription
tpjversioninfo_fileflags
tpjversioninfo_fileflagsmask
tpjversioninfo_filename
tpjversioninfo_fileos
tpjversioninfo_filesubtype
tpjversioninfo_filetype
tpjversioninfo_fileversion
tpjversioninfo_fileversionnumber
tpjversioninfo_fixedfileinfo
tpjversioninfo_haveinfo
tpjversioninfo_internalname
tpjversioninfo_language
tpjversioninfo_languagecode
tpjversioninfo_legalcopyright
tpjversioninfo_legaltrademarks
tpjversioninfo_numtranslations
tpjversioninfo_object
tpjversioninfo_originalfilename
tpjversioninfo_privatebuild
tpjversioninfo_productname
tpjversioninfo_productversion
tpjversioninfo_productversionnumber
tpjversioninfo_specialbuild
tpjversioninfo_stringfileinfo
tpjversionnumber

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,926 @@
{
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/
*
* Copyright (C) 1998-2013, Peter Johnson (www.delphidabbler.com).
*
* $Rev: 1110 $
* $Date: 2013-01-13 23:26:17 +0000 (Sun, 13 Jan 2013) $
*
* Version Information Component. The component reads version information from
* executable files.
}
unit PJVersionInfo;
// Determine if certain features are supported by compiler
// * Supports_Assert - Defined if assertions supported (all compilers
// except Delphi 2).
// * Supports_ResourceString - Defined if resourcestring keyword supported (all
// compilers except Delphi 2).
// * Supports_AdvancedRecords - Defined if advanced records with record methods,
// operator overloads etc. supported (Delphi 2006
// and later).
// * Supports_RTLNameSpaces - Defined if Delphi RTL / VCL unit references
// should be qualified with namespaces.
{$DEFINE Supports_Assert}
{$DEFINE Supports_ResourceString}
{$UNDEF Supports_AdvancedRecords}
{$UNDEF Supports_RTLNameSpaces}
{$IFDEF VER90} // Delphi 2
{$UNDEF Supports_Assert}
{$UNDEF Supports_ResourceString}
{$ENDIF}
// Switch off unsafe code warnings if switch supported
{$IFDEF CONDITIONALEXPRESSIONS}
{$IF CompilerVersion >= 15.0} // >= Delphi 7
{$WARN UNSAFE_CODE OFF}
{$IFEND}
{$IF CompilerVersion >= 18.0} // >= Delphi 2006
{$DEFINE Supports_AdvancedRecords}
{$IFEND}
{$IF CompilerVersion >= 23.0} // Delphi XE2
{$DEFINE Supports_RTLNameSpaces}
{$IFEND}
{$ENDIF}
interface
uses
// Delphi
{$IFDEF Supports_RTLNameSpaces}
Winapi.Windows, System.Classes;
{$ELSE}
Windows, Classes;
{$ENDIF}
type
{
TPJVersionNumber:
Record that encapsulates version numbers.
}
TPJVersionNumber = record
V1: Word; // Major version number
V2: Word; // Minor version number
V3: Word; // Revision version number
V4: Word; // Build number
{$IFDEF Supports_AdvancedRecords}
class operator Implicit(Ver: TPJVersionNumber): string;
{Operator overload that performs implicit conversion of TPJVersionNumber
to string as dotted quad.
@param Ver [in] Version number to be converted.
@return Version number as dotted quad.
}
class operator LessThanOrEqual(Ver1, Ver2: TPJVersionNumber): Boolean;
{Operator overload that compares two version numbers to check if first is
less than or equal to the second.
@param Ver1 [in] First version number.
@param Ver2 [in] Second version number.
@return True if Ver1 <= Ver2, False otherwise.
}
class operator LessThan(Ver1, Ver2: TPJVersionNumber): Boolean;
{Operator overload that compares two version numbers to check if first is
less than second.
@param Ver1 [in] First version number.
@param Ver2 [in] Second version number.
@return True if Ver1 < Ver2, False otherwise.
}
class operator GreaterThan(Ver1, Ver2: TPJVersionNumber): Boolean;
{Operator overload that compares two version numbers to check if first is
greater than second.
@param Ver1 [in] First version number.
@param Ver2 [in] Second version number.
@return True if Ver1 > Ver2, False otherwise.
}
class operator GreaterThanOrEqual(Ver1, Ver2: TPJVersionNumber): Boolean;
{Operator overload that compares two version numbers to check if first is
greater than or equal to the second.
@param Ver1 [in] First version number.
@param Ver2 [in] Second version number.
@return True if Ver1 >= Ver2, False otherwise.
}
class operator Equal(Ver1, Ver2: TPJVersionNumber): Boolean;
{Operator overload that compares two version numbers to check for
equality.
@param Ver1 [in] First version number.
@param Ver2 [in] Second version number.
@return True if Ver1 = Ver2, False otherwise.
}
class operator NotEqual(Ver1, Ver2: TPJVersionNumber): Boolean;
{Operator overload that compares two version numbers to check for
inequality.
@param Ver1 [in] First version number.
@param Ver2 [in] Second version number.
@return True if Ver1 <> Ver2, False otherwise.
}
{$ENDIF}
end;
{
TPJVersionInfo:
Component that accesses the version information embedded in an executable
file and exposes the information as properties. Supports multi-lingual
version iformation resources.
}
TPJVersionInfo = class(TComponent)
private // properties
fFileName: string;
fHaveInfo: Boolean;
fNumTranslations: Integer;
fCurrentTranslation: Integer;
fFixedFileInfo: TVSFixedFileInfo;
procedure SetFileName(AName: string);
function GetProductVersionNumber: TPJVersionNumber;
function GetFileVersionNumber: TPJVersionNumber;
function GetLanguage: string;
function GetCharSet: string;
function GetCharSetCode: WORD;
function GetLanguageCode: WORD;
function GetCurrentTranslation: Integer;
procedure SetCurrentTranslation(const Value: Integer);
function GetStringFileInfo(const Name: string): string;
function GetStringFileInfoByIdx(Index: Integer): string;
function GetFixedFileInfoItemByIdx(Index: Integer): DWORD;
private
fPInfoBuffer: PChar; // Pointer to info buffer
fPTransBuffer: Pointer; // Pointer to translation buffer
procedure GetInfoBuffer(Len: DWORD);
{Creates an info buffer of required size.
@param Len [in] Required buffer size in characters.
}
procedure GetTransBuffer(Len: UINT);
{Creates a translation table buffer of required size.
@param Required buffer size in bytes.
}
function GetTransStr: string;
{Encodes information about the current translation in a string.
@return Required translation information.
}
protected
procedure ClearProperties; virtual;
{Forces properties to return cleared values.
}
procedure ReadVersionInfo; virtual;
{Reads version info from file named by FileName property.
}
public
constructor Create(AOwner: TComponent); override;
{Object constructor. Sets default values.
@param AOwner [in] Component that owns this one. May be nil.
}
destructor Destroy; override;
{Object destructor. Frees allocated memory.
}
property HaveInfo: Boolean
read fHaveInfo;
{Property true if file version info for the file named by the FileName
property has been successfully read}
property FixedFileInfo: TVSFixedFileInfo
read fFixedFileInfo;
{Exposes the whole fixed file info record. Following properties expose
the various fields of it}
property FileVersionNumber: TPJVersionNumber
read GetFileVersionNumber;
{Version number of file in numeric format. From fixed file info}
property ProductVersionNumber: TPJVersionNumber
read GetProductVersionNumber;
{Version number of product in numeric format. From fixed file info}
property FileOS: DWORD index 0
read GetFixedFileInfoItemByIdx;
{Code describing operating system to be used by file, From fixed file
info}
property FileType: DWORD index 1
read GetFixedFileInfoItemByIdx;
{Code descibing type of file. From fixed file info}
property FileSubType: DWORD index 2
read GetFixedFileInfoItemByIdx;
{Code describing sub-type of file - only used for certain values of
FileType property. From fixed file info}
property FileFlagsMask: DWORD index 3
read GetFixedFileInfoItemByIdx;
{Code describing which FileFlags are valid. From fixed file info}
property FileFlags: DWORD index 4
read GetFixedFileInfoItemByIdx;
{Flags describing file state. From fixed file info}
property Comments: string index 0
read GetStringFileInfoByIdx;
{String file info property giving user defined comments in current
translation}
property CompanyName: string index 1
read GetStringFileInfoByIdx;
{String file info property giving name of company in current translation}
property FileDescription: string index 2
read GetStringFileInfoByIdx;
{String file info property giving description of file in current
translation}
property FileVersion: string index 3
read GetStringFileInfoByIdx;
{String file info property giving version number of file in string format
in current translation}
property InternalName: string index 4
read GetStringFileInfoByIdx;
{String file info property giving internal name of file in current
translation}
property LegalCopyright: string index 5
read GetStringFileInfoByIdx;
{String file info property giving copyright message in current
translation}
property LegalTrademarks: string index 6
read GetStringFileInfoByIdx;
{String file info property giving trademark info in current translation}
property OriginalFileName: string index 7
read GetStringFileInfoByIdx;
{String file info property giving original name of file in current
translation}
property PrivateBuild: string index 8
read GetStringFileInfoByIdx;
{String file info property giving information about a private build of
file in current translation}
property ProductName: string index 9
read GetStringFileInfoByIdx;
{String file info property giving name of product in current translation}
property ProductVersion: string index 10
read GetStringFileInfoByIdx;
{String file info property giving version number of product in string
format in current translation}
property SpecialBuild: string index 11
read GetStringFileInfoByIdx;
{String file info property giving information about a special build of
file in current translation}
property StringFileInfo[const Name: string]: string
read GetStringFileInfo;
{Value of named string file info item in current translation. This
property can access both standard and custom string info}
property Language: string
read GetLanguage;
{Name of language in use in current translation}
property CharSet: string
read GetCharSet;
{Name of character set in use in current translation}
property LanguageCode: WORD
read GetLanguageCode;
{Code of laguage in use in current translation}
property CharSetCode: WORD
read GetCharSetCode;
{Code of character set in use in current translation}
property NumTranslations: Integer
read fNumTranslations;
{The number of difference translations (ie languages and char sets) in
the version information}
property CurrentTranslation: Integer
read GetCurrentTranslation write SetCurrentTranslation;
{Zero-based index of the current translation: this is 0 when a file is
first accessed. Set to a value in range 0..NumTranslations-1 to access
other translations. All string info, language and char set properties
return information for the current translation}
published
property FileName: string read fFileName write SetFileName;
{Name of file containing version information. If set to '' (default) the
version information comes from the containing executable file}
end;
function VerNumToStr(const Ver: TPJVersionNumber): string;
{Converts a version number to its string representation as a dotted quad.
@param Ver [in] Version number to be converted.
@return Version number as dotted quad.
}
function CompareVerNums(const Ver1, Ver2: TPJVersionNumber): Integer;
{Compares two version numbers and returns a value indicating if the first is
less than, equal to or greater than the second.
@param Ver1 [in] First version number to compare.
@param Ver2 [in] Second version number to compare.
@return 0 if Ver1 = Ver2, -ve if Ver1 < Ver2, +ve if Ver1 > Ver2.
}
procedure Register;
{Registers this component.
}
implementation
uses
{$IFDEF Supports_RTLNameSpaces}
System.SysUtils;
{$ELSE}
// Delphi
SysUtils;
{$ENDIF}
procedure Register;
{Registers this component.
}
begin
RegisterComponents('DelphiDabbler', [TPJVersionInfo]);
end;
type
// ANSI version of CPINFOEX: provides information about a code page
_cpinfoexA = packed record
MaxCharSize: UINT;
{max length in bytes of a character in the code page}
DefaultChar: array[0..MAX_DEFAULTCHAR-1] of Byte;
{default character used to translate strings to the specific code page}
LeadByte: array[0..MAX_LEADBYTES-1] of Byte;
{fixed-length array of lead byte ranges: all elements null if none}
UnicodeDefaultChar: WideChar;
{unicode default char used in translations from the specific code page}
CodePage: UINT;
{code page value}
CodePageName: array[0..MAX_PATH-1] of AnsiChar;
{full localised name of the code page}
end;
CPINFOEXA = _cpinfoexA;
PCPInfoExA = ^CPINFOEXA;
TCPInfoExA = CPINFOEXA;
// Unicode version of CPINFOEX: provides information about a code page
_cpinfoexW = packed record
MaxCharSize: UINT;
{max length in bytes of a character in the code page}
DefaultChar: array[0..MAX_DEFAULTCHAR-1] of Byte;
{default character used to translate strings to the specific code page}
LeadByte: array[0..MAX_LEADBYTES-1] of Byte;
{fixed-length array of lead byte ranges: all elements null if none}
UnicodeDefaultChar: WideChar;
{unicode default char used in translations from the specific code page}
CodePage: UINT;
{code page value}
CodePageName: array[0..MAX_PATH-1] of WideChar;
{full localised name of the code page}
end;
CPINFOEXW = _cpinfoexW;
PCPInfoExW = ^CPINFOEXW;
TCPInfoExW = CPINFOEXW;
// Set TCPInfoEx etc to required ANSI or Unicode version of structure
{$IFDEF UNICODE}
TCPInfoEx = TCPInfoExW;
PCPInfoEx = PCPInfoExW;
{$ELSE}
TCPInfoEx = TCPInfoExA;
PCPInfoEx = PCPInfoExA;
{$ENDIF}
CPINFOEX = TCPInfoEx;
var
// Pointer to Windows API GetCPInfoEx function if it exists or to GetCPInfoAlt
// otherwise
GetCPInfoExFn: function (CodePage: UINT; dwFlags: DWORD;
var lpCPInfoEx: TCPInfoEx): BOOL; stdcall;
const
// Import name of GetCPInfoEx. Unicode and ANSI versions.
{$IFDEF UNICODE}
cGetCPInfoEx = 'GetCPInfoExW';
{$ELSE}
cGetCPInfoEx = 'GetCPInfoExA';
{$ENDIF}
function GetCPInfoAlt(CodePage: UINT; dwFlags: DWORD;
var lpCPInfoEx: TCPInfoEx): BOOL; stdcall;
{Local implementation of GetCPInfoEx, for use on OSs that don't support
GetCPInfoEx. Calls older GetCPInfo API function and calculates members of
TCPInfoEx not provided by GetCPInfo.
@param CodePage [in] Code page for which information is required.
@param dwFlags [in] Reserved. Must be 0.
@param lpCPInfoEx [in/out] Structure that receives information about the
code page.
@return True on success, False on error.
}
// ---------------------------------------------------------------------------
procedure CopyByteArray(const Src: array of Byte; var Dest: array of Byte);
{Makes a copy of a byte array.
@param Src [in] Byte array to be copied.
@param Dest [in/out] In: Array to receive copy: must be same size as Src.
Out: Receives copy of Src.
}
var
Idx: Integer; // loops thru array
begin
{$IFDEF Supports_Assert}
Assert((Low(Src) = Low(Dest)) and (High(Src) = High(Dest)));
{$ENDIF}
for Idx := Low(Src) to High(Src) do
Dest[Idx] := Src[Idx];
end;
// ---------------------------------------------------------------------------
const
sCodePage = 'Code Page %d'; // description of code page if OS doesn't provide
var
OldInfo: TCPInfo; // old style code page info structure for Win95/NT4
begin
// We haven't got GetCPInfoEx: use old GetCPInfo to get some info
Result := GetCPInfo(CodePage, OldInfo);
if Result then
begin
// We update TCPInfoEx structure from old style structure and calculate
// additional info
// copy over from old style TCPInfo structure
lpCPInfoEx.MaxCharSize := OldInfo.MaxCharSize;
CopyByteArray(OldInfo.DefaultChar, lpCPInfoEx.DefaultChar);
CopyByteArray(OldInfo.LeadByte, lpCPInfoEx.LeadByte);
// no new default char
lpCPInfoEx.UnicodeDefaultChar := #0;
// store reference to code page
lpCPInfoEx.CodePage := CodePage;
// description is simply "Code Page NNN"
StrPLCopy(
lpCPInfoEx.CodePageName,
Format(sCodePage, [CodePage]),
SizeOf(lpCPInfoEx.CodePageName)
);
end;
end;
function VerNumToStr(const Ver: TPJVersionNumber): string;
{Converts a version number to its string representation as a dotted quad.
@param Ver [in] Version number to be converted.
@return Version number as dotted quad.
}
begin
Result := Format('%d.%d.%d.%d', [Ver.V1, Ver.V2, Ver.V3, Ver.V4]);
end;
function CompareVerNums(const Ver1, Ver2: TPJVersionNumber): Integer;
{Compares two version numbers and returns a value indicating if the first is
less than, equal to or greater than the second.
@param Ver1 [in] First version number to compare.
@param Ver2 [in] Second version number to compare.
@return 0 if Ver1 = Ver2, -ve if Ver1 < Ver2, +ve if Ver1 > Ver2.
}
begin
Result := Ver1.V1 - Ver2.V1;
if Result <> 0 then
Exit;
Result := Ver1.V2 - Ver2.V2;
if Result <> 0 then
Exit;
Result := Ver1.V3 - Ver2.V3;
if Result <> 0 then
Exit;
Result := Ver1.V4 - Ver2.V4;
end;
type
{
TTransRec:
Record of language code and char set codes that are returned from version
information.
}
TTransRec = packed record
Lang: Word; // language code
CharSet: Word; // character set code
end;
{
TTransRecs:
Type used to type cast translation data into an array of translation
records.
}
TTransRecs = array[0..1000] of TTransRec;
{
PTransRecs:
Pointer to an array of translation records.
}
PTransRecs = ^TTransRecs;
{ TPJVersionInfo }
procedure TPJVersionInfo.ClearProperties;
{Forces properties to return cleared values.
}
begin
// Record that we haven't read ver info: this effectively clears properties
// since each property read access method checks this flag before returning
// result
fHaveInfo := False;
end;
constructor TPJVersionInfo.Create(AOwner: TComponent);
{Object constructor. Sets default values.
@param AOwner [in] Component that owns this one. May be nil.
}
begin
inherited Create(AOwner);
// Default is no file name - refers to executable file for application
FileName := '';
end;
destructor TPJVersionInfo.Destroy;
{Object destructor. Frees allocated memory.
}
begin
// Ensure that info buffer is freed if allocated
if fPInfoBuffer <> nil then
StrDispose(fPInfoBuffer);
// Ensure that translation buffer is free if allocated
if fPTransBuffer <> nil then
FreeMem(fPTransBuffer);
inherited Destroy;
end;
function TPJVersionInfo.GetCharSet: string;
{Read accessor for CharSet property:
@return String describing character set if version info is available or
empty string if not.
}
var
Info: TCPInfoEx; // receives code page info
CP: Word; // code page
const
// Special code page messages
sUnknownCP = '%d (Unknown Code Page)'; // unknown
// Messages for pages API can't return (managed apps only)
sUTF16LE = '%d (Unicode UTF-16, little endian byte order)';
sUTF16BE = '%d (Unicode UTF-16, big endian byte order)';
sUTF32LE = '%d (Unicode UTF-32, little endian byte order)';
sUTF32BE = '%d (Unicode UTF-32, big endian byte order)';
begin
Result := '';
if fHaveInfo then
begin
CP := GetCharSetCode;
case CP of
// Check for char codes only available in managed apps (API call won't
// find them)
1200: Result := Format(sUTF16LE, [CP]);
1201: Result := Format(sUTF16BE, [CP]);
12000: Result := Format(sUTF32LE, [CP]);
12001: Result := Format(sUTF32BE, [CP]);
else
begin
// Not a known problem code page: get it from OS
if GetCPInfoExFn(CP, 0, Info) then
Result := Info.CodePageName
else
// Give up: can't find it
Result := Format(sUnknownCP, [CP]);
end;
end;
end;
end;
function TPJVersionInfo.GetCharSetCode: WORD;
{Read accessor for CharSetCode property.
@return Char set code for current translation or 0 if there is no
translation or there is no version info.
}
begin
if fHaveInfo and (GetCurrentTranslation >= 0) then
Result := PTransRecs(fPTransBuffer)^[GetCurrentTranslation].CharSet
else
Result := 0;
end;
function TPJVersionInfo.GetCurrentTranslation: Integer;
{Read accessor for CurrentTranslation property.
@return Index to current translation if version info is available or -1 if
not.
}
begin
if fHaveInfo then
Result := fCurrentTranslation
else
Result := -1;
end;
function TPJVersionInfo.GetFileVersionNumber: TPJVersionNumber;
{Read accessor for FileVersionNumber property.
@return Record containing version information. If there is no version info
then all fields will be zero.
}
begin
Result.V1 := HiWord(fFixedFileInfo.dwFileVersionMS);
Result.V2 := LoWord(fFixedFileInfo.dwFileVersionMS);
Result.V3 := HiWord(fFixedFileInfo.dwFileVersionLS);
Result.V4 := LoWord(fFixedFileInfo.dwFileVersionLS);
end;
function TPJVersionInfo.GetFixedFileInfoItemByIdx(Index: Integer): DWORD;
{Read accessor method for various DWORD fields of the fixed file information
record accessed by index.
NOTE: This is a fix for C++ Builder. Delphi is able to access the fields of
the TVSFixedFileInfo record directly in the read clause of the property
declaration but this is not possible in C++ Builder.
@param Index [in] Index of required property.
@return Required DWORD value.
}
begin
case Index of
0: Result := fFixedFileInfo.dwFileOS;
1: Result := fFixedFileInfo.dwFileType;
2: Result := fFixedFileInfo.dwFileSubType;
3: Result := fFixedFileInfo.dwFileFlagsMask;
4: Result := fFixedFileInfo.dwFileFlags;
else Result := 0;
end;
end;
procedure TPJVersionInfo.GetInfoBuffer(Len: DWORD);
{Creates an info buffer of required size.
@param Len [in] Required buffer size in characters.
}
begin
// Clear any existing buffer
if fPInfoBuffer <> nil then
StrDispose(fPInfoBuffer);
// Create the new one
fPInfoBuffer := StrAlloc(Len);
end;
function TPJVersionInfo.GetLanguage: string;
{Read accessor for Language property
@return String describing language or empty string if no version info
available.
}
const
cBufSize = 256; // size of buffer
var
Buf: array[0..Pred(cBufSize)] of Char; // stores langauge string from API call
begin
// Assume failure
Result := '';
// Try to get language name from Win API if we have ver info
if fHaveInfo and
(VerLanguageName(GetLanguageCode, Buf, Pred(cBufSize)) > 0) then
Result := Buf;
end;
function TPJVersionInfo.GetLanguageCode: WORD;
{Read accessor for LanguageCode property
@return Language code for current translation or 0 if there is no
translation or there is no version info.
}
begin
if fHaveInfo and (GetCurrentTranslation >= 0) then
Result := PTransRecs(fPTransBuffer)^[GetCurrentTranslation].Lang
else
Result := 0;
end;
function TPJVersionInfo.GetProductVersionNumber: TPJVersionNumber;
{Read accessor for ProductVersionNumber property.
@return Record containing version information. If there is no version info
then all fields will be zero.
}
begin
Result.V1 := HiWord(fFixedFileInfo.dwProductVersionMS);
Result.V2 := LoWord(fFixedFileInfo.dwProductVersionMS);
Result.V3 := HiWord(fFixedFileInfo.dwProductVersionLS);
Result.V4 := LoWord(fFixedFileInfo.dwProductVersionLS);
end;
function TPJVersionInfo.GetStringFileInfo(const Name: string): string;
{Read accessor for StringFileInfo array property.
@param Name [in] Name of required string information.
@return String associated Name or empty string if there is no version info.
}
var
CommandBuf: array[0..255] of char; // buffer to build API call command str
Ptr: Pointer; // pointer to result of API call
Len: UINT; // length of structure returned from API
begin
// Set default failure result to empty string
Result := '';
// Check if we have valid information recorded in info buffer - exit if not
if fHaveInfo then
begin
// Build API call command string for reading string file info:
// this uses info string + language and character set
StrPCopy(CommandBuf, '\StringFileInfo\' + GetTransStr + '\' + Name);
// Call API to get required string and return it if successful
if VerQueryValue(fPInfoBuffer, CommandBuf, Ptr, Len) then
Result := PChar(Ptr);
end;
end;
function TPJVersionInfo.GetStringFileInfoByIdx(Index: Integer): string;
{Read accessor for all string file info properties.
@param Index [in] Index of required property.
@return Appropriate string value of the indexed property or empty string if
property has no value or there is no version info.
}
const
cNames: array[0..11] of string =
('Comments', 'CompanyName', 'FileDescription', 'FileVersion',
'InternalName', 'LegalCopyright', 'LegalTrademarks', 'OriginalFileName',
'PrivateBuild', 'ProductName', 'ProductVersion', 'SpecialBuild');
{names of predefined string file info strings}
begin
Result := GetStringFileInfo(cNames[Index]);
end;
procedure TPJVersionInfo.GetTransBuffer(Len: UINT);
{Creates a translation table buffer of required size.
@param Required buffer size in bytes.
}
begin
// Clear any existing buffer
if fPTransBuffer <> nil then
FreeMem(fPTransBuffer);
// Create the new one
GetMem(fPTransBuffer, Len);
end;
function TPJVersionInfo.GetTransStr: string;
{Encodes information about the current translation in a string.
@return Required translation information.
}
var
TransRec: TTransRec; // translation record in array of translations
begin
if GetCurrentTranslation >= 0 then
begin
// There is a valid current translation: return hex string related to it
TransRec := PTransRecs(fPTransBuffer)^[GetCurrentTranslation];
Result := Format('%4.4x%4.4x', [TransRec.Lang, TransRec.CharSet]);
end
else
// No valid translation string: return empty string
Result := '';
end;
procedure TPJVersionInfo.ReadVersionInfo;
{Reads version info from file named by FileName property.
}
var
Len: UINT; // length of structs returned from API calls
Ptr: Pointer; // points to version info structures
InfoSize: DWORD; // size of info buffer
Dummy: DWORD; // stores 0 in call to GetFileVersionInfoSize
begin
// Record default value of HaveInfo property - no info read
fHaveInfo := False;
// Store zeros in fixed file info structure: this is used when no info
FillChar(fFixedFileInfo, SizeOf(fFixedFileInfo), 0);
// Set NumTranslations property to 0: this is value if no info
fNumTranslations := 0;
// Record required size of version info buffer
InfoSize := GetFileVersionInfoSize(PChar(fFileName), Dummy);
// Check that there was no error
if InfoSize > 0 then
begin
// Found info size OK
// Ensure we have a sufficiently large buffer allocated
GetInfoBuffer(InfoSize);
// Read file version info into storage and check success
if GetFileVersionInfo(PChar(fFileName), Dummy, InfoSize, fPInfoBuffer) then
begin
// Success: we've read file version info to storage OK
fHaveInfo := True;
// Get fixed file info & copy to own storage
VerQueryValue(fPInfoBuffer, '\', Ptr, Len);
fFixedFileInfo := PVSFixedFileInfo(Ptr)^;
// Get first translation table info from API
VerQueryValue(fPInfoBuffer, '\VarFileInfo\Translation', Ptr, Len);
// Ptr is to block of translation records each of size Len:
// work out number of translations
fNumTranslations := Len div SizeOf(TTransRec);
// store translation array in a buffer
GetTransBuffer(Len);
Move(Ptr^, fPTransBuffer^, Len);
// make first translation in block current one (-1 if no translations)
SetCurrentTranslation(0); // adjusts value to -1 if no translations
end;
end;
end;
procedure TPJVersionInfo.SetCurrentTranslation(const Value: Integer);
{Write acceesor method CurrentTranslation property
@param Index of required translation. If Value is out of range then the
property is set to -1 to indicate no translation.
}
begin
if (Value >= 0) and (Value < NumTranslations) then
fCurrentTranslation := Value
else
fCurrentTranslation := -1
end;
procedure TPJVersionInfo.SetFileName(AName: string);
{Write accessor for FileName property. Action at design time and run time is
different. At design time we simply record the property value while at run
time we store the value and read any version information from the file.
@param AName [in] New value of FileName property. If '' then property is set
to the name of the program's executable file.
}
begin
if csDesigning in ComponentState then
// We are designing, simply record the required name
fFileName := AName
else
begin
// It's run-time
// use Application exec file name if name is ''
if AName = '' then
fFileName := ParamStr(0)
else
fFileName := AName;
// clear all properties and read file version info for new file
ClearProperties;
ReadVersionInfo;
end;
end;
{$IFDEF Supports_AdvancedRecords}
{ TPJVersionNumber }
class operator TPJVersionNumber.Equal(Ver1, Ver2: TPJVersionNumber): Boolean;
{Operator overload that compares two version numbers to check for equality.
@param Ver1 [in] First version number.
@param Ver2 [in] Second version number.
@return True if Ver1 = Ver2, False otherwise.
}
begin
Result := CompareVerNums(Ver1, Ver2) = 0;
end;
class operator TPJVersionNumber.GreaterThan(Ver1,
Ver2: TPJVersionNumber): Boolean;
{Operator overload that compares two version numbers to check if first is
greater than second.
@param Ver1 [in] First version number.
@param Ver2 [in] Second version number.
@return True if Ver1 > Ver2, False otherwise.
}
begin
Result := CompareVerNums(Ver1, Ver2) > 0;
end;
class operator TPJVersionNumber.GreaterThanOrEqual(Ver1,
Ver2: TPJVersionNumber): Boolean;
{Operator overload that compares two version numbers to check if first is
greater than or equal to the second.
@param Ver1 [in] First version number.
@param Ver2 [in] Second version number.
@return True if Ver1 >= Ver2, False otherwise.
}
begin
Result := CompareVerNums(Ver1, Ver2) >= 0;
end;
class operator TPJVersionNumber.Implicit(Ver: TPJVersionNumber): string;
{Operator overload that performs implicit conversion of TPJVersionNumber to
string as dotted quad.
@param Ver [in] Version number to be converted.
@return Version number as dotted quad.
}
begin
Result := VerNumToStr(Ver);
end;
class operator TPJVersionNumber.LessThan(Ver1, Ver2: TPJVersionNumber): Boolean;
{Operator overload that compares two version numbers to check if first is less
than second.
@param Ver1 [in] First version number.
@param Ver2 [in] Second version number.
@return True if Ver1 < Ver2, False otherwise.
}
begin
Result := CompareVerNums(Ver1, Ver2) < 0;
end;
class operator TPJVersionNumber.LessThanOrEqual(Ver1,
Ver2: TPJVersionNumber): Boolean;
{Operator overload that compares two version numbers to check if first is less
than or equal to the second.
@param Ver1 [in] First version number.
@param Ver2 [in] Second version number.
@return True if Ver1 <= Ver2, False otherwise.
}
begin
Result := CompareVerNums(Ver1, Ver2) <= 0;
end;
class operator TPJVersionNumber.NotEqual(Ver1, Ver2: TPJVersionNumber): Boolean;
{Operator overload that compares two version numbers to check for inequality.
@param Ver1 [in] First version number.
@param Ver2 [in] Second version number.
@return True if Ver1 <> Ver2, False otherwise.
}
begin
Result := CompareVerNums(Ver1, Ver2) <> 0;
end;
{$ENDIF}
initialization
// Get reference to GetCPInfoEx function
GetCPInfoExFn := GetProcAddress(GetModuleHandle('Kernel32.dll'), cGetCPInfoEx);
if not Assigned(GetCPInfoExFn) then
GetCPInfoExFn := GetCPInfoAlt;
end.

451
dd-verinfo/ReadMe.htm Normal file
View File

@@ -0,0 +1,451 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/
*
* Copyright (C) 2005-2013, Peter Johnson (www.delphidabbler.com).
*
* $Rev: 1131 $
* $Date: 2013-01-14 03:27:03 +0000 (Mon, 14 Jan 2013) $
*
* Read-me file for Version Information Component.
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>
DelphiDabbler Version Information Component ReadMe
</title>
<style type="text/css">
body {
margin: 1em;
padding: 0;
font-family: Verdana, Arial, sans-serif;
font-size: 9pt;
line-height: 150%;
}
h1 {
margin: 0 0 1em 0;
padding: 0.5em;
border: 1px silver solid;
background-color: #eee;
font-size: 13pt;
font-weight: bold;
text-align: center;
}
h1 .subtitle {
font-style: italic;
color: #336;
}
h2 {
margin: 1em 0 0 0;
padding: 0;
padding-bottom: 6px;
border-bottom: 1px silver solid;
font-size: 11pt;
font-weight: bold;
}
h3 {
margin: 0.5em 0 0 0;
padding: 0;
font-size: 9pt;
font-weight: bold;
}
p {
margin: 0.5em 0 0 0;
padding: 0;
}
ul, ol {
margin: 0.5em 0 0 3em;
padding: 0;
}
ul {
list-style-type: square;
}
ul.spaced li,
ol.spaced li {
margin-top: 0.5em;
}
ul.spaced li,
ol.spaced li {
margin-top: 0.5em;
}
ul.unspaced li,
ol.unspaced li {
margin-top: 0;
}
ul.unspaced li.first,
ol.unspaced li.first {
margin-top: 0.5em;
}
code {
font-family: "Courier New", Courier, monospace;
}
a:link {
color: #336;
text-decoration: underline;
}
a:visited {
color: #669;
text-decoration: underline;
}
a:active {
color: #336;
text-decoration: underline;
}
a:hover {
text-decoration: underline;
}
.pullout {
border-left: 8px silver solid;
background-color: #eee;
margin: 0.5em 0 0 0;
padding: 0.25em 0.5em;
font-style: italic;
}
.indent {
margin-left: 3em;
}
.highlight {
color: #336;
font-style: italic;
font-weight: bold;
}
.endnotes {
margin: 1.5em 0 0 0;
padding: 1em 0 0 0;
border-top: 1px silver solid;
}
.comments {
font-style: italic;
}
.copyright,
.copyright a:link,
.copyright a:visited,
.copyright a:active {
margin: 1em 0 0 0;
color: gray;
font-size: 8pt;
text-align: right;
}
</style>
</head>
<body>
<h1>
<div>Version Information Component</div>
<div class="subtitle">ReadMe</div>
</h1>
<h2 id="contents">
Contents
</h2>
<ul>
<li><a href="#description">Description</a></li>
<li><a href="#installation">Installation</a></li>
<li><a href="#demo">Demo Projects</a></li>
<li><a href="#update">Update History</a></li>
<li><a href="#license">License</a></li>
<li><a href="#bugs">Bugs and Feature Requests</a></li>
<li><a href="#author">About the Author</a></li>
</ul>
<h2 id="description">
Description
</h2>
<p>
<var>TPJVersionInfo</var> is a 32 bit non-visual component for all Win32
versions of Delphi that encapsulates the version information contained in an
executable file's resources.
</p>
<p>
The component reads information from a designated file's
<var>VERSIONINFO</var> resource. The required file is specified in the
component's <var>FileName</var> property. Setting <var>FileName</var> to the
empty string fetches version information for the executable file containing
the component. The boolean <var>HaveInfo</var> property indicates whether the
file contains version information. This component can access variable file
information for each language provided in the resource.
</p>
<p>
Run-time properties enable access to to version information. Properties
enable:
</p>
<ul>
<li>
Access to fixed file information, either by field or the whole record.
</li>
<li>
Access to the number of translations stored in the version information.
</li>
<li>
Selection of the translation for which information is to be returned by
other properties.
</li>
<li>
Access to the language and code page of the current translation &ndash; by
code and by name.
</li>
<li>
Access to the string file information for the current translation &ndash;
named properties access the Microsoft-defined string information, while an
array property gives access to any string item by name.
</li>
</ul>
<p>
Version numbers are encapsulated in <var>TPJVersionNumber</var> records which,
on Delphi 2006 or later, can be directly assigned to a string and can be
compared using the normal equality operators. Helper functions are also
provided for use with earlier Delphis that can format version numbers as text
and can compare them.
</p>
<h3>
Limitations
</h3>
<p>
The component makes calls to the Windows API. Therefore the version
information being read must follow the Microsoft guidelines &ndash; be warned
that not all software complies!
</p>
<h3>
Compatibility
</h3>
<p>
<var>TPJVersionInfo</var> compiles on all Win32 versions and personalities of
Delphi. Releases up v3.3 have tested with Delphi versions 2, 3, 4, 6, 7, 2006
and 2010 while later releases have been tested on Delphi 7 and 2006 to XE3 and
are assumed to work on later versions.
</p>
<p>
The unit name changed to <code>PJVersionInfo</code> at release 3 &ndash; this
means that programs using earlier versions will need to be modified (or to
have an alias set in Delphi's Project Options) before being recompiled using
the new version. Functionally, the component is backward compatible with
earlier versions.
</p>
<h3>
Further information
</h3>
<p>
For detailed information about version information refer to the Windows SDK.
</p>
<h2 id="installation">
Installation
</h2>
<div class="pullout">
<strong>Important Note:</strong> If you are updating from an earlier version
of this component and have installed the <em>DelphiDabbler</em> About Box
Component (<var>TPJAboutBoxDlg</var>) you may need to uninstall it before
updating this component, and re-install the about box component once the
update has been installed. If the About Box Component is earlier that v3.2 it
will need to be updated to the most recent version.
</div>
<p>
The <em>Version Information Component</em> is supplied in a zip file. Before
installing you need to extract all the files from the zip file. The following
files will be extracted:
</p>
<ul>
<li>
<strong><code>PJVersionInfo.pas</code></strong> &ndash; Component source
code.
</li>
<li>
<strong><code>PJVersionInfo.dcr</code></strong> &ndash; Component palette
glyph.
</li>
<li>
<code>PJVersionInfo.hlp</code> &ndash; Help file that integrates into the
Delphi 3-7 IDE.
</li>
<li>
<code>PJVersionInfo.als</code> &ndash; Keyword file required when
integrating the help file with Delphi 6 and 7.
</li>
<li>
<code>ReadMe.htm</code> &ndash; This read-me file.
</li>
<li>
<code>ChangeLog.txt</code> &ndash; Change log.
</li>
<li>
<code>MPL-2.txt</code> &ndash; Mozilla Public License v2.0.
</li>
<li>
<code>Documentation.URL</code> &ndash; Shortcut to the component's online
documentation.
</li>
</ul>
<p>
In addition to the above files you will find the the source code of two <a
href="#demo"
>demo projects</a> along with readme files in the <code>Demos\1</code> and
<code>Demos\2</code> sub-directories.
</p>
<p>
You can now install the component into the Delphi IDE.
</p>
<p>
For Delphi 3 onwards you must include <code>PJVersionInfo.pas</code> and
<code>PJVersionInfo.dcr</code> in a design time package that is installed into
the Delphi IDE. If you need help doing this <a
href="http://www.delphidabbler.com/url/install-comp"
>see here</a>.
</p>
<p>
Note that the help file included in the download can only integrate with the
IDE in Delphi 3-7. For information on how to do this, see <a
href="http://www.delphidabbler.com/articles?article=15"
>this article</a>. Users of other versions of Delphi can either use the help
file as a stand-alone file (in which case some links won't work) or you can
use the component's <a
href="http://www.delphidabbler.com/url/verinfo-docs"
>online documentation</a>.
</p>
<h2 id="demo">
Demo Projects
</h2>
<p>
The source code for two demo projects is included. The demos are:
</p>
<ol class="spaced">
<li>
<code>VIDemo.dpr</code> is an application that can extract and display
version information from any program (provided that the program has valid
version information).
</li>
<li>
<code>HelpEgs.dpr</code> implements all the <a
href="http://delphidabbler.com/url/verinfo-egs"
>examples</a> from the online documentation and help file.
</li>
</ol>
<p>
These demos require Delphi 7 or later.
</p>
<p>
<strong>Note:</strong> To load the projects into Delphi 2007 first delete the
relevant <code>.dproj</code> file and then load the project from the
<code>.bdsproj</code> file.
</p>
<div class="pullout">
With some minor changes they will also compile as 64 bit Windows targets using
the 64 bit Delphi. (Tested with Delphi XE3). To do this create a 64 bit
Windows target, ensure that the compiler can find the component source file
(or a 64 bit compiled unit) and disable automatic version information
generation.
</div>
<h2 id="update">
Update History
</h2>
<p>
A complete change log is provided in a text file that is included in the
download.
</p>
<h2 id="license">
License
</h2>
<p>
This component is released under the terms of the <a
href="http://www.mozilla.org/MPL/2.0/"
>Mozilla Public License v2.0</a>.
</p>
<h2 id="bugs">
Bugs and Feature Requests
</h2>
<p>
Bugs can be reported or new features requested via the <a
href="http://www.delphidabbler.com/url/ddlib-issues"
>Issue Tracker</a>.
</p>
<p>
If no similar report or request has been recorded already, use the <em>New
Issue</em> link to add a new issue. Please select the <em>Defect Report from
User</em> template and be sure to specify the <code>Project-verinfo</code>
label.
</p>
<p>
Feature requests are also made using the Issue Tracker. This time please
select the <em>Feature Request</em> template and, again, specify the
<code>Project-verinfo</code> label.
</p>
<h2 id="author">
About the Author
</h2>
<p>
I'm Peter Johnson &ndash; a hobbyist programmer living in Ceredigion in West
Wales, UK, writing write mainly in Delphi. My programs and code are
available from: <a
href="http://www.delphidabbler.com/"
>http://www.delphidabbler.com/</a>.
</p>
<p>
I can be <a
href="http://www.delphidabbler.com/contact"
>contacted via the website</a>.
</p>
<div class="endnotes">
<div class="comments">
Please <a
href="http://www.delphidabbler.com/contact"
>let me know</a> if you have any comments about the component, but please
use the Issue Tracker noted above to report bugs and request new features.
</div>
<div class="copyright">
This document is copyright &copy; 2005-2013, P D Johnson, <a
href="http://www.delphidabbler.com/"
>www.delphidabbler.com</a>.
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,72 @@
<?xml version="1.0"?>
<CONFIG>
<Package Version="4">
<PathDelim Value="\"/>
<Name Value="dd_versioninfo"/>
<Author Value="Peter Johnson"/>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
</Linking>
<Other>
<CompilerMessages>
<MsgFileName Value=""/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Description Value=" TPJVersionInfo is a 32 bit non-visual component for all Win32 versions of Delphi that encapsulates the version information contained in an executable file's resources.
The component reads information from a designated file's VERSIONINFO resource. The required file is specified in the component's FileName property. Setting FileName to the empty string fetches version information for the executable file containing the component. The boolean HaveInfo property indicates whether the file contains version information. This component can access variable file information for each language provided in the resource.
Run-time properties enable access to to version information. Properties enable:
Access to fixed file information, either by field or the whole record.
Access to the number of translations stored in the version information.
Selection of the translation for which information is to be returned by other properties.
Access to the language and code page of the current translation by code and by name.
Access to the string file information for the current translation named properties access the Microsoft-defined string information, while an array property gives access to any string item by name.
Version numbers are encapsulated in TPJVersionNumber records which, on Delphi 2006 or later, can be directly assigned to a string and can be compared using the normal equality operators. Helper functions are also provided for use with earlier Delphis that can format version numbers as text and can compare them. "/>
<License Value="This Source Code Form is subject to the terms of the Mozilla Public License"/>
<Version Major="3" Minor="3" Release="1"/>
<Files Count="1">
<Item1>
<Filename Value="PJVersionInfo.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="PJVersionInfo"/>
</Item1>
</Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="1">
<Item1>
<PackageName Value="FCL"/>
</Item1>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
</Package>
</CONFIG>

View File

@@ -0,0 +1,21 @@
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit dd_versioninfo;
interface
uses
PJVersionInfo, LazarusPackageIntf;
implementation
procedure Register;
begin
RegisterUnit('PJVersionInfo', @PJVersionInfo.Register);
end;
initialization
RegisterPackage('dd_versioninfo', @Register);
end.