forked from wangshu/printv1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfm_OEM_Unit.pas
84 lines (76 loc) · 2.44 KB
/
fm_OEM_Unit.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
unit fm_OEM_Unit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
cxContainer, cxEdit, Menus, StdCtrls, cxMemo, cxTextEdit, cxButtons,
cxGroupBox,des, dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinCaramel,
dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinFoggy,
dxSkinGlassOceans, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky,
dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins,
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinPumpkin, dxSkinSeven,
dxSkinSharp, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
dxSkinSummer2008, dxSkinsDefaultPainters, dxSkinValentine,
dxSkinXmas2008Blue;
type
Tfm_oem = class(TForm)
cxGroupBox1: TcxGroupBox;
cxGroupBox2: TcxGroupBox;
cxButton1: TcxButton;
cxGroupBox3: TcxGroupBox;
cxTextEdit1: TcxTextEdit;
cxTextEdit2: TcxTextEdit;
cxMemo1: TcxMemo;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure cxButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
fm_oem: Tfm_oem;
function GetVersionString(FileName: string): string;
implementation
uses fm_main_unit;
{$R *.dfm}
function GetVersionString(FileName: string): string;
var
VerInfoSize: DWORD;
VerInfo: Pointer;
VerValueSize: DWORD;
Dummy: DWORD;
VerValue: PVSFixedFileInfo;
begin
Result := '';
VerInfoSize := GetFileVersionInfoSize(PChar(FileName), Dummy);
if VerInfoSize = 0 then Exit;
GetMem(VerInfo, VerInfoSize);
GetFileVersionInfo(PChar(FileName), 0, VerInfoSize, VerInfo);
VerQueryValue(VerInfo, '\', Pointer(VerValue), VerValueSize);
Result := IntToStr(VerValue^.dwFileVersionMS shr 16) + '.' +
IntToStr(VerValue^.dwFileVersionMS and $FFFF) + '.' +
IntToStr(VerValue^.dwFileVersionLS shr 16) + '.' +
IntToStr(VerValue^.dwFileVersionLS and $FFFF);
FreeMem(VerInfo);
end;
procedure Tfm_oem.cxButton1Click(Sender: TObject);
var
str:string;
begin
str:=UpperCase( Des.EnCrypt(GetVersionString(Application.ExeName)));
if cxTextEdit1.Text=str then
begin
frm_main.SetAbout('main',cxTextEdit2.text);
frm_main.SetAbout('about',cxMemo1.Text);
Close;
end
else
close;
end;
end.