RxFPC:demo for RxVersionInfo

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4642 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2016-05-11 06:49:22 +00:00
parent a6fd807723
commit b30ff02cd5
6 changed files with 419 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="project1"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<VersionInfo>
<UseVersionInfo Value="True"/>
<MajorVersionNr Value="1"/>
<Attributes pvaDebug="True" pvaPatched="True" pvaSpecialBuild="True"/>
<StringTable Comments="this is test for RxVersionInfo" CompanyName="(c) Alexs" FileDescription="this is test for RxVersionInfo" InternalName="test for RxVersionInfo" LegalCopyright="(c) Alexs" LegalTrademarks="(c) Alexs" OriginalFilename="RxVersionTest" ProductName="RxVersionTest" ProductVersion="1.0"/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="3">
<Item1>
<PackageName Value="LazControls"/>
</Item1>
<Item2>
<PackageName Value="rxnew"/>
</Item2>
<Item3>
<PackageName Value="LCL"/>
</Item3>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="project1"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,21 @@
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1, rxnew, lazcontrols
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

Binary file not shown.

View File

@ -0,0 +1,210 @@
object Form1: TForm1
Left = 793
Height = 421
Top = 299
Width = 429
Caption = 'RxVersionInfo'
ClientHeight = 421
ClientWidth = 429
Position = poScreenCenter
LCLVersion = '1.7'
object Label1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Button2
AnchorSideTop.Side = asrBottom
Left = 6
Height = 20
Top = 44
Width = 280
BorderSpacing.Around = 6
Caption = 'Test file name ( empyt line = ParamStr(0) )'
ParentColor = False
end
object FileNameEdit1: TFileNameEdit
AnchorSideLeft.Control = Label1
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Button1
Left = 12
Height = 30
Top = 70
Width = 291
FilterIndex = 0
HideDirectories = False
ButtonWidth = 23
NumGlyphs = 1
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
MaxLength = 0
TabOrder = 0
end
object Label2: TLabel
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Edit1
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 20
Top = 142
Width = 62
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 6
Caption = 'File name'
ParentColor = False
end
object Edit1: TEdit
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = DividerBevel1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 112
Height = 30
Top = 132
Width = 311
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
Color = clMoneyGreen
ReadOnly = True
TabOrder = 1
end
object Label3: TLabel
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Edit2
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 20
Top = 178
Width = 73
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 6
Caption = 'File version'
ParentColor = False
end
object Edit2: TEdit
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Edit1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 112
Height = 30
Top = 168
Width = 311
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
Color = clMoneyGreen
ReadOnly = True
TabOrder = 2
end
object Button1: TButton
AnchorSideTop.Control = FileNameEdit1
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 309
Height = 32
Top = 70
Width = 114
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Right = 6
Caption = 'Get version info'
OnClick = Button1Click
TabOrder = 3
end
object DividerBevel1: TDividerBevel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = FileNameEdit1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 20
Top = 106
Width = 429
Caption = 'Version info'
Anchors = [akTop, akLeft, akRight]
Font.Style = [fsBold]
ParentFont = False
end
object Button2: TButton
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Owner
Left = 183
Height = 32
Top = 6
Width = 63
AutoSize = True
BorderSpacing.Top = 6
Caption = 'About...'
OnClick = Button2Click
TabOrder = 4
end
object Label4: TLabel
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Edit3
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 20
Top = 214
Width = 100
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 6
Caption = 'Company name'
ParentColor = False
end
object Edit3: TEdit
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Edit2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 112
Height = 30
Top = 204
Width = 311
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
Color = clMoneyGreen
ReadOnly = True
TabOrder = 5
end
object Label5: TLabel
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Edit4
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 20
Top = 250
Width = 98
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 6
Caption = 'File description'
ParentColor = False
end
object Edit4: TEdit
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Edit3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 112
Height = 30
Top = 240
Width = 311
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
Color = clMoneyGreen
ReadOnly = True
TabOrder = 6
end
object RxAboutDialog1: TRxAboutDialog
Options = []
Caption = 'О системе'
left = 256
end
end

View File

@ -0,0 +1,102 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, RxAboutDialog, DividerBevel, Forms, Controls,
Graphics, Dialogs, StdCtrls, EditBtn;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
DividerBevel1: TDividerBevel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
FileNameEdit1: TFileNameEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
RxAboutDialog1: TRxAboutDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
uses RxVersInfo;
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
FRxVersionInfo: TRxVersionInfo;
begin
FRxVersionInfo:=TRxVersionInfo.Create(nil);
try
if FileNameEdit1.FileName<>'' then
FRxVersionInfo.FileName:=FileNameEdit1.FileName;
if FRxVersionInfo.Valid then
begin
Edit1.TextHint:='';
Edit1.Text:=FRxVersionInfo.FileName;
Edit2.Text:=FRxVersionInfo.FileLongVersion;
Edit3.Text:=FRxVersionInfo.CompanyName;
Edit4.Text:=FRxVersionInfo.FileDescription;
{
property ProductLongVersion: TLongVersion read GetProductLongVersion;
property Translation: Pointer read GetTranslation;
property VersionLanguage: TVersionLanguage read GetVersionLanguage;
property VersionCharSet: TVersionCharSet read GetVersionCharSet;
property VersionNum: Longint read GetVersionNum;
property Comments: string read GetComments;
property FileVersion: string read GetFileVersion;
property InternalName: string read GetInternalName;
property LegalCopyright: string read GetLegalCopyright;
property LegalTrademarks: string read GetLegalTrademarks;
property OriginalFilename: string read GetOriginalFilename;
property ProductVersion: string read GetProductVersion;
property ProductName: string read GetProductName;
property SpecialBuild: string read GetSpecialBuild;
property PrivateBuild: string read GetPrivateBuild;
property Values[const VerName: string]: string read GetVerValue;
property VerFileDate: TDateTime read GetVerFileDate;
}
end
else
begin
Edit1.Text:='';
Edit1.TextHint:='Resourse information not found.';
Edit2.Text:='';
Edit3.Text:='';
Edit4.Text:='';
end;
finally
FRxVersionInfo.Free;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
RxAboutDialog1.Execute;
end;
end.