/[projects]/dao/DelphiScanner/Components/tpsystools_4.04/source/StVInfo.pas
ViewVC logotype

Contents of /dao/DelphiScanner/Components/tpsystools_4.04/source/StVInfo.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2671 - (show annotations) (download)
Tue Aug 25 18:15:15 2015 UTC (8 years, 9 months ago) by torben
File size: 23651 byte(s)
Added tpsystools component
1 // Upgraded to Delphi 2009: Sebastian Zierer
2
3 (* ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is TurboPower SysTools
17 *
18 * The Initial Developer of the Original Code is
19 * TurboPower Software
20 *
21 * Portions created by the Initial Developer are Copyright (C) 1996-2002
22 * the Initial Developer. All Rights Reserved.
23 *
24 * Contributor(s):
25 *
26 * ***** END LICENSE BLOCK ***** *)
27
28 {*********************************************************}
29 {* SysTools: StVInfo.pas 4.04 *}
30 {*********************************************************}
31 {* SysTools: Version Information Extraction Component *}
32 {*********************************************************}
33
34 {$I StDefine.inc}
35
36 {$I+} {I/O Checking On}
37
38 unit StVInfo;
39
40 interface
41
42 uses
43 Windows, SysUtils, Classes,
44 StBase, StConst;
45
46 {!!.02 - added }
47 const
48 STVERMAJOR = 0;
49 STVERMINOR = 1;
50 STVERBUILD = 2;
51 STVERRELEASE = 3;
52 {!!.02 - added end }
53
54 type
55 PVerTranslation = ^TVerTranslation;
56 TVerTranslation = record
57 Language : Word;
58 CharSet : Word;
59 end;
60
61 TStCustomVersionInfo = class(TStComponent)
62 protected {private}
63 {$Z+}
64 FComments : string;
65 FCompanyName : string;
66 FFileDescription : string;
67 FFileDate : TDateTime;
68 FFileFlags : DWORD; {!!.02}
69 FFileFlagsMask : DWORD; {!!.02}
70 FFileMajorVersion : DWORD; {!!.02}
71 FFileMinorVersion : DWORD; {!!.02}
72 FFileName : string;
73 FFileOS : DWORD; {!!.02}
74 FFileType : DWORD; {!!.02}
75 FFileSubtype : DWORD; {!!.02}
76 FFileVersion : string;
77 FFileVersionFloat : Double;
78 FInternalName : string;
79 FLanguageCount : LongInt;
80 FLanguageName : string;
81 FLegalCopyright : string;
82 FLegalTrademark : string;
83 FOriginalFilename : string;
84 FProductMajorVersion : DWORD; {!!.02}
85 FProductMinorVersion : DWORD; {!!.02}
86 FProductName : string;
87 FProductVersion : string;
88 FProductVersionFloat : Double;
89 FTranslationValue : LongInt;
90 VInfoLoaded : Boolean;
91
92 function GetComments : string;
93 function GetCompanyName : string;
94 function GetFileDate: TDateTime;
95 function GetFileDescription : string;
96 function GetFileFlags: DWORD; {!!.02}
97 function GetFileFlagsMask: DWORD; {!!.02}
98 function GetFileMajorVersion: DWORD; {!!.02}
99 function GetFileMinorVersion: DWORD; {!!.02}
100 function GetFileOS: DWORD; {!!.02}
101 function GetFileSubtype: DWORD; {!!.02}
102 function GetFileType: DWORD; {!!.02}
103 function GetFileVersion : string;
104 function GetFileVersionFloat : Double;
105 function GetInternalName : string;
106 function GetLanguageCount: LongInt;
107 function GetLanguageName: string;
108 function GetLegalCopyright : string;
109 function GetLegalTrademark : string;
110 function GetOriginalFilename : string;
111 function GetProductMajorVersion: DWORD; {!!.02}
112 function GetProductMinorVersion: DWORD; {!!.02}
113 function GetProductName : string;
114 function GetProductVersion : string;
115 function GetProductVersionFloat : Double;
116 function GetTranslationValue: LongInt;
117 procedure SetFileName(const Value : string);
118
119 function LoadVersionInfo(const Key : string) : string;
120 procedure Loaded; override;
121
122 {!!.02 - added }
123 function GetFileVerSubPart(Index : Integer) : Word;
124 function GetProdVerSubPart(Index : Integer) : Word;
125 {!!.02 - added end }
126
127 protected
128
129 {$Z-}
130 {properties}
131 property Comments : string
132 read GetComments;
133
134 property CompanyName : string
135 read GetCompanyName;
136
137 property FileDate : TDateTime
138 read GetFileDate;
139
140 property FileDescription : string
141 read GetFileDescription;
142
143 property FileFlags : DWORD {!!.02}
144 read GetFileFlags;
145
146 property FileFlagsMask : DWORD {!!.02}
147 read GetFileFlagsMask;
148
149 property FileMajorVersion : DWORD {!!.02}
150 read GetFileMajorVersion;
151
152 property FileMinorVersion : DWORD {!!.02}
153 read GetFileMinorVersion;
154
155 property FileName : string
156 read FFileName write SetFileName;
157
158 property FileOS : DWORD {!!.02}
159 read GetFileOS;
160
161 property FileType : DWORD {!!.02}
162 read GetFileType;
163
164 property FileSubtype : DWORD {!!.02}
165 read GetFileSubtype;
166
167 property FileVersion : string
168 read GetFileVersion;
169
170 property FileVersionFloat : Double
171 read GetFileVersionFloat;
172
173 property InternalName : string
174 read GetInternalName;
175
176 property LanguageCount : LongInt
177 read GetLanguageCount;
178
179 property LanguageName : string
180 read GetLanguageName;
181
182 property LegalCopyright : string
183 read GetLegalCopyright;
184
185 property LegalTrademark : string
186 read GetLegalTrademark;
187
188 property OriginalFilename : string
189 read GetOriginalFilename;
190
191 property ProductName : string
192 read GetProductName;
193
194 property ProductMajorVersion : DWORD {!!.02}
195 read GetProductMajorVersion;
196
197 property ProductMinorVersion : DWORD {!!.02}
198 read GetProductMinorVersion;
199
200 property ProductVersion : string
201 read GetProductVersion;
202
203 property ProductVersionFloat : Double
204 read GetProductVersionFloat;
205
206 property TranslationValue : LongInt
207 read GetTranslationValue;
208
209 {!!.02 - added }
210 property FileVerMajor : Word
211 index STVERMAJOR read GetFileVerSubPart;
212 property FileVerMinor : Word
213 index STVERMINOR read GetFileVerSubPart;
214 property FileVerBuild : Word
215 index STVERBUILD read GetFileVerSubPart;
216 property FileVerRelease : Word
217 index STVERRELEASE read GetFileVerSubPart;
218 property ProductVerMajor : Word
219 index STVERMAJOR read GetProdVerSubPart;
220 property ProductVerMinor : Word
221 index STVERMINOR read GetProdVerSubPart;
222 property ProductVerBuild : Word
223 index STVERBUILD read GetProdVerSubPart;
224 property ProductVerRelease : Word
225 index STVERRELEASE read GetProdVerSubPart;
226 {!!.02 - added end }
227
228
229 public
230 { Public declarations }
231 {$Z+}
232 constructor Create(AOwner : TComponent);
233 override;
234 destructor Destroy;
235 override;
236 {$Z-}
237 function GetKeyValue(const Key : string) : string;
238
239 published
240 { Published declarations }
241 end;
242
243 TStVersionInfo = class(TStCustomVersionInfo)
244 public
245 {properties}
246 property Comments;
247 property CompanyName;
248 property FileDescription;
249 property FileDate;
250 property FileFlags;
251 property FileFlagsMask;
252 property FileMajorVersion;
253 property FileMinorVersion;
254 property FileOS;
255 property FileType;
256 property FileSubtype;
257 property FileVersion;
258 property FileVersionFloat;
259 property InternalName;
260 property LanguageCount;
261 property LanguageName;
262 property LegalCopyright;
263 property LegalTrademark;
264 property OriginalFilename;
265 property ProductMajorVersion;
266 property ProductMinorVersion;
267 property ProductName;
268 property ProductVersion;
269 property ProductVersionFloat;
270 property TranslationValue;
271
272 {!!.02 - added }
273 property FileVerMajor;
274 property FileVerMinor;
275 property FileVerBuild;
276 property FileVerRelease;
277 property ProductVerMajor;
278 property ProductVerMinor;
279 property ProductVerBuild;
280 property ProductVerRelease;
281 {!!.02 - added end }
282
283
284 published
285 {properties}
286 property FileName;
287 end;
288
289 implementation
290
291 constructor TStCustomVersionInfo.Create(AOwner : TComponent);
292 begin
293 inherited Create(AOwner);
294 VInfoLoaded := False;
295 SetFileName('');
296 end;
297
298 destructor TStCustomVersionInfo.Destroy;
299 begin
300 inherited Destroy;
301 end;
302
303 function TStCustomVersionInfo.LoadVersionInfo(const Key : string) : string;
304 var
305 Handle : DWORD;
306 Res : Boolean;
307 Size : Integer;
308 Error : LongInt;
309 Data : Pointer;
310 Buffer : Pointer;
311 ErrCode : Integer;
312 {$IFDEF VERSION4}
313 Bytes : Cardinal;
314 {$ELSE}
315 Bytes : Integer;
316 {$ENDIF}
317 TempStr : array [0..259] of Char;
318 LangBuff: array [0..259] of Char;
319 BaseStr : string;
320 InfoStr : string;
321 Trans : PVerTranslation;
322 TrSize : Integer;
323 FixedInfo : TVSFixedFileInfo;
324 FT : TFileTime; {!!.02}
325 ST : TSystemTime; {!!.02}
326
327 function MakeFloat(S : string) : Double;
328 var
329 Buff : array [0..5] of Char;
330 I : Integer;
331 Count : Integer;
332 begin
333 Count := 0;
334 FillChar(Buff, SizeOf(Buff), 0);
335 Buff[0] := '0';
336 { The file version string might be specified like }
337 { 4.72.3105.0. Parse it down to just one decimal }
338 { place and create the floating point version #. }
339 for I := 1 to Pred(Length(S)) do begin
340 if S[I] = '.' then begin
341 { Found the first period. Replace it with the DecimalSeparator }
342 { constant so that StrToFloat works properly. }
343 S[I] := {$IFDEF DELPHIXE2}FormatSettings.{$ENDIF}DecimalSeparator;
344 Inc(Count);
345 if (Count = 2) and (I <= Length(Buff)) then begin
346 Move(S[1], Buff, (I - 1) * SizeOf(Char));
347 Break;
348 end;
349 end;
350 end;
351 Result := StrToFloat(Buff);
352 end;
353
354 begin
355 TrSize := 0;
356 Size := GetFileVersionInfoSize(StrPCopy(TempStr, FFileName), Handle);
357 if Size = 0 then begin
358 { GetFileVersionInfoSize might fail because the }
359 { file is a 16-bit file or because the file does not }
360 { contain version info. }
361 Error := GetLastError;
362 if Error = ERROR_RESOURCE_TYPE_NOT_FOUND then
363 RaiseStError(EStVersionInfoError, stscNoVerInfo);
364 if Error = 0 then
365 RaiseStError(EStVersionInfoError, stscVerInfoFail);
366 end;
367
368 { Allocate some memory and get version info block. }
369 GetMem(Data, Size);
370 Res := GetFileVersionInfo(TempStr, Handle, Size, Data);
371 Trans := nil;
372 try
373 if not Res then
374 { Error. Raise an exception. }
375 RaiseStError(EStVersionInfoError, stscVerInfoFail);
376
377 { Get the translation value. We need it to get the version info. }
378 Res := VerQueryValue(Data, '\VarFileInfo\Translation', Buffer, Bytes);
379 if not Res then
380 RaiseStError(EStVersionInfoError, stscVerInfoFail);
381 TrSize := Bytes;
382 GetMem(Trans, TrSize);
383 Move(Buffer^, Trans^, TrSize);
384 FTranslationValue := LongInt(Trans^);
385 FLanguageCount := Bytes div SizeOf(TVerTranslation);
386 VerLanguageName(Trans^.Language, LangBuff, Length(LangBuff));
387 FLanguageName := StrPas(LangBuff);
388 VInfoLoaded := True;
389
390 { Build a base string including the translation value. }
391 BaseStr := Format('StringFileInfo\%.4x%.4x\', [Trans^.Language, Trans^.CharSet]);
392
393 { User-defined string. Get the string and exit. }
394 if Key <> '' then begin
395 InfoStr := BaseStr + Key;
396 Res := VerQueryValue(Data, StrPCopy(TempStr, InfoStr), Buffer, Bytes);
397
398 if Res then begin
399 Result := StrPas(PChar(Buffer));
400 // Exit; {!!.02}
401 end else begin
402 Result := '';
403 RaiseStError(EStVersionInfoError, stscBadVerInfoKey);
404 end;
405 end {!!.02}
406 else begin {!!.02}
407
408 { Get the fixed version info. }
409 Bytes := SizeOf(FixedInfo);
410 FillChar(FixedInfo, Bytes, 0);
411 { '\' is used to get the root block. }
412 Res := VerQueryValue(Data, '\', Buffer, Bytes);
413 if not Res then
414 RaiseStError(EStVersionInfoError, stscVerInfoFail);
415
416 Move(Buffer^, FixedInfo, Bytes);
417 with FixedInfo do begin
418 FFileMajorVersion := dwFileVersionMS;
419 FFileMinorVersion := dwFileVersionLS;
420 FProductMajorVersion := dwProductVersionMS;
421 FProductMinorVersion := dwProductVersionLS;
422 FFileFlagsMask := dwFileFlagsMask;
423 FFileFlags := dwFileFlags;
424
425 {!!.02 - rewritten }
426 { Note: Most files don't set the binary date. }
427 // FFileDate := MakeLong(dwFileDateMS, dwFileDateLS);
428 FT.dwHighDateTime := dwFileDateMS;
429 FT.dwLowDateTime := dwFileDateLS;
430 FileTimeToSystemTime(FT, ST);
431 FFileDate := SystemTimeToDateTime(ST);
432 {!!.02 - rewritten end}
433
434 FFileOS := dwFileOS;
435 FFileType := dwFileType;
436 FFileSubtype := dwFileSubtype;
437 end;
438
439 { Comments }
440 InfoStr := BaseStr + 'Comments';
441 Res := VerQueryValue(Data, StrPCopy(TempStr, InfoStr), Buffer, Bytes);
442 if Res and (Bytes <> 0) then
443 FComments := StrPas(PChar(Buffer))
444 else
445 FComments := '';
446
447 { CompanyName }
448 InfoStr := BaseStr + 'CompanyName';
449 Res := VerQueryValue(Data, StrPCopy(TempStr, InfoStr), Buffer, Bytes);
450 if Res and (Bytes <> 0) then
451 FCompanyName := StrPas(PChar(Buffer))
452 else
453 FCompanyName := '';
454
455 { FileDescription }
456 InfoStr := BaseStr + 'FileDescription';
457 Res := VerQueryValue(Data, StrPCopy(TempStr, InfoStr), Buffer, Bytes);
458 if Res and (Bytes <> 0) then
459 FFileDescription := StrPas(PChar(Buffer))
460 else
461 FFileDescription := '';
462
463 { FileVersion }
464 InfoStr := BaseStr + 'FileVersion';
465 Res := VerQueryValue(Data, StrPCopy(TempStr, InfoStr), Buffer, Bytes);
466 if Res and (Bytes <> 0) then begin
467 FFileVersion := StrPas(PChar(Buffer));
468 { First try to convert the version number to a float as-is. }
469 Val(FFileVersion, FFileVersionFloat, ErrCode);
470 if ErrCode <> 0 then
471 { Failed. Create the float with the local MakeFloat function. }
472 try
473 FFileVersionFloat := MakeFloat(FFileVersion);
474 except
475 FFileVersionFloat := 0;
476 end;
477 end else begin
478 FFileVersion := '';
479 FFileVersionFloat := 0;
480 end;
481
482 { InternalName }
483 InfoStr := BaseStr + 'InternalName';
484 Res := VerQueryValue(Data, StrPCopy(TempStr, InfoStr), Buffer, Bytes);
485 if Res and (Bytes <> 0) then
486 FInternalName := StrPas(PChar(Buffer))
487 else
488 FInternalName := '';
489
490 { LegalCopyright }
491 InfoStr := BaseStr + 'LegalCopyright';
492 Res := VerQueryValue(Data, StrPCopy(TempStr, InfoStr), Buffer, Bytes);
493 if Res and (Bytes <> 0) then
494 FLegalCopyright := StrPas(PChar(Buffer))
495 else
496 FLegalCopyright := '';
497
498 { LegalTrademarks }
499 InfoStr := BaseStr + 'LegalTrademarks';
500 Res := VerQueryValue(Data, StrPCopy(TempStr, InfoStr), Buffer, Bytes);
501 if Res and (Bytes <> 0) then
502 FLegalTrademark := StrPas(PChar(Buffer))
503 else
504 FLegalTrademark := '';
505
506 { OriginalFilename }
507 InfoStr := BaseStr + 'OriginalFilename';
508 Res := VerQueryValue(Data, StrPCopy(TempStr, InfoStr), Buffer, Bytes);
509 if Res and (Bytes <> 0) then
510 FOriginalFilename := StrPas(PChar(Buffer))
511 else
512 FOriginalFilename := '';
513
514 { ProductName }
515 InfoStr := BaseStr + 'ProductName';
516 Res := VerQueryValue(Data, StrPCopy(TempStr, InfoStr), Buffer, Bytes);
517 if Res and (Bytes <> 0) then
518 FProductName := StrPas(PChar(Buffer))
519 else
520 FProductName := '';
521
522 { ProductVersion }
523 InfoStr := BaseStr + 'ProductVersion';
524 Res := VerQueryValue(Data, StrPCopy(TempStr, InfoStr), Buffer, Bytes);
525 if Res and (Bytes <> 0) then begin
526 FProductVersion := StrPas(PChar(Buffer));
527 { First try to convert the product number to a float as-is. }
528 Val(FProductVersion, FProductVersionFloat, ErrCode);
529 if ErrCode <> 0 then
530 { Failed. Create the float with the local MakeFloat function. }
531 try
532 FProductVersionFloat := MakeFloat(FProductVersion);
533 except
534 FProductVersionFloat := 0;
535 end;
536 end else begin
537 FProductVersion := '';
538 FProductVersionFloat := 0;
539 end;
540
541 end; {!!.02}
542
543 finally
544 FreeMem(Data, Size);
545 FreeMem(Trans, TrSize);
546 end;
547 end;
548
549 function TStCustomVersionInfo.GetComments : string;
550 begin
551 if not VInfoLoaded then
552 LoadVersionInfo('');
553 Result := FComments;
554 end;
555
556 function TStCustomVersionInfo.GetCompanyName : string;
557 begin
558 if not VInfoLoaded then
559 LoadVersionInfo('');
560 Result := FCompanyName;
561 end;
562
563 function TStCustomVersionInfo.GetFileDescription : string;
564 begin
565 if not VInfoLoaded then
566 LoadVersionInfo('');
567 Result := FFileDescription;
568 end;
569
570 function TStCustomVersionInfo.GetFileVersion : string;
571 begin
572 if not VInfoLoaded then
573 LoadVersionInfo('');
574 Result := FFileVersion;
575 end;
576
577 function TStCustomVersionInfo.GetInternalName : string;
578 begin
579 if not VInfoLoaded then
580 LoadVersionInfo('');
581 Result := FInternalName;
582 end;
583
584 function TStCustomVersionInfo.GetLegalCopyright : string;
585 begin
586 if not VInfoLoaded then
587 LoadVersionInfo('');
588 Result := FLegalCopyright;
589 end;
590
591 function TStCustomVersionInfo.GetLegalTrademark : string;
592 begin
593 if not VInfoLoaded then
594 LoadVersionInfo('');
595 Result := FLegalTrademark;
596 end;
597
598 function TStCustomVersionInfo.GetOriginalFilename : string;
599 begin
600 if not VInfoLoaded then
601 LoadVersionInfo('');
602 Result := FOriginalFilename;
603 end;
604
605 function TStCustomVersionInfo.GetProductName : string;
606 begin
607 if not VInfoLoaded then
608 LoadVersionInfo('');
609 Result := FProductName;
610 end;
611
612 function TStCustomVersionInfo.GetProductVersion : string;
613 begin
614 if not VInfoLoaded then
615 LoadVersionInfo('');
616 Result := FProductVersion;
617 end;
618
619 function TStCustomVersionInfo.GetProductVersionFloat : Double;
620 begin
621 if not VInfoLoaded then
622 LoadVersionInfo('');
623 Result := FProductVersionFloat;
624 end;
625
626 function TStCustomVersionInfo.GetFileVersionFloat : Double;
627 begin
628 if not VInfoLoaded then
629 LoadVersionInfo('');
630 Result := FFileVersionFloat;
631 end;
632
633 procedure TStCustomVersionInfo.SetFileName(const Value : string);
634 var
635 Buff : array [0..255] of Char;
636 begin
637 if (Value <> '') and not (csDesigning in ComponentState) then
638 if not FileExists(Value) then
639 RaiseStError(EStVersionInfoError, stscFileOpen);
640 if FFileName <> Value then
641 VInfoLoaded := False;
642 FFileName := Value;
643 { If FileName is an emtpy string then load the }
644 { version info for the current process. }
645 if (FFileName = '') and not (csDesigning in ComponentState) then
646 if GetModuleFileName(0, Buff, Length(Buff)) = 0 then
647 FFileName := ''
648 else
649 FFileName := StrPas(Buff);
650 end;
651
652 function TStCustomVersionInfo.GetFileDate: TDateTime;
653 begin
654 if not VInfoLoaded then
655 LoadVersionInfo('');
656 Result := FFileDate;
657 end;
658
659 function TStCustomVersionInfo.GetFileFlags: DWORD; {!!.02}
660 begin
661 if not VInfoLoaded then
662 LoadVersionInfo('');
663 Result := FFileFlags;
664 end;
665
666 function TStCustomVersionInfo.GetFileFlagsMask: DWORD; {!!.02}
667 begin
668 if not VInfoLoaded then
669 LoadVersionInfo('');
670 Result := FFileFlagsMask;
671 end;
672
673 function TStCustomVersionInfo.GetFileOS: DWORD; {!!.02}
674 begin
675 if not VInfoLoaded then
676 LoadVersionInfo('');
677 Result := FFileOS;
678 end;
679
680 function TStCustomVersionInfo.GetFileSubtype: DWORD; {!!.02}
681 begin
682 if not VInfoLoaded then
683 LoadVersionInfo('');
684 Result := FFileSubtype;
685 end;
686
687 function TStCustomVersionInfo.GetFileType: DWORD; {!!.02}
688 begin
689 if not VInfoLoaded then
690 LoadVersionInfo('');
691 Result := FFileType;
692 end;
693
694 function TStCustomVersionInfo.GetFileMajorVersion: DWORD; {!!.02}
695 begin
696 if not VInfoLoaded then
697 LoadVersionInfo('');
698 Result := FFileMajorVersion;
699 end;
700
701 function TStCustomVersionInfo.GetFileMinorVersion: DWORD; {!!.02}
702 begin
703 if not VInfoLoaded then
704 LoadVersionInfo('');
705 Result := FFileMinorVersion;
706 end;
707
708 function TStCustomVersionInfo.GetProductMajorVersion: DWORD; {!!.02}
709 begin
710 if not VInfoLoaded then
711 LoadVersionInfo('');
712 Result := FProductMajorVersion;
713 end;
714
715 function TStCustomVersionInfo.GetProductMinorVersion: DWORD; {!!.02}
716 begin
717 if not VInfoLoaded then
718 LoadVersionInfo('');
719 Result := FProductMinorVersion;
720 end;
721
722 function TStCustomVersionInfo.GetLanguageCount: LongInt;
723 begin
724 if not VInfoLoaded then
725 LoadVersionInfo('');
726 Result := FLanguageCount;
727 end;
728
729 function TStCustomVersionInfo.GetLanguageName: string;
730 begin
731 if not VInfoLoaded then
732 LoadVersionInfo('');
733 Result := FLanguageName;
734 end;
735
736 function TStCustomVersionInfo.GetTranslationValue: LongInt;
737 begin
738 if not VInfoLoaded then
739 LoadVersionInfo('');
740 Result := FTranslationValue;
741 end;
742
743 function TStCustomVersionInfo.GetKeyValue(const Key: string): string;
744 begin
745 Result := LoadVersionInfo(Key);
746 end;
747
748 procedure TStCustomVersionInfo.Loaded;
749 begin
750 inherited Loaded;
751 if FFileName = '' then
752 SetFileName('');
753 end;
754
755 {!!.02 - added }
756 function TStCustomVersionInfo.GetFileVerSubPart(Index: Integer): Word;
757 begin
758 Result := 0;
759 if not VInfoLoaded then
760 LoadVersionInfo('');
761 case Index of
762 STVERMAJOR: Result := HIWORD(FFileMajorVersion);
763 STVERMINOR: Result := LOWORD(FFileMajorVersion);
764 STVERBUILD: Result := HIWORD(FFileMinorVersion);
765 STVERRELEASE: Result := LOWORD(FFileMinorVersion);
766 end; { case }
767 end;
768
769 function TStCustomVersionInfo.GetProdVerSubPart(Index: Integer): Word;
770 begin
771 Result := 0;
772 if not VInfoLoaded then
773 LoadVersionInfo('');
774 case Index of
775 STVERMAJOR: Result := HIWORD(FProductMajorVersion);
776 STVERMINOR: Result := LOWORD(FProductMajorVersion);
777 STVERBUILD: Result := HIWORD(FProductMinorVersion);
778 STVERRELEASE: Result := LOWORD(FProductMinorVersion);
779 end; { case }
780 end;
781 {!!.02 - added end }
782
783 end.

  ViewVC Help
Powered by ViewVC 1.1.20