Changeset 501
- Timestamp:
- Jan 22, 2018, 10:36:38 AM (7 years ago)
- Location:
- Common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/UApplicationInfo.pas
r468 r501 14 14 TApplicationInfo = class(TComponent) 15 15 private 16 FDescription: string; 16 17 FIdentification: Byte; 17 18 FLicense: string; … … 33 34 constructor Create(AOwner: TComponent); override; 34 35 property Version: string read GetVersion; 36 function GetRegistryContext: TRegistryContext; 35 37 published 36 38 property Identification: Byte read FIdentification write FIdentification; … … 45 47 property EmailContact: string read FEmailContact write FEmailContact; 46 48 property AppName: string read FAppName write FAppName; 49 property Description: string read FDescription write FDescription; 47 50 property ReleaseDate: TDateTime read FReleaseDate write FReleaseDate; 48 51 property RegistryKey: string read FRegistryKey write FRegistryKey; … … 79 82 end; 80 83 84 function TApplicationInfo.GetRegistryContext: TRegistryContext; 85 begin 86 Result := TRegistryContext.Create(RegistryRoot, RegistryKey); 87 end; 88 81 89 end. -
Common/URegistry.pas
r456 r501 9 9 10 10 type 11 TRegistryRoot = (rrKeyClassesRoot = HKEY($80000000), 12 rrKeyCurrentUser = HKEY($80000001), 13 rrKeyLocalMachine = HKEY($80000002), 14 rrKeyUsers = HKEY($80000003), 15 rrKeyPerformanceData = HKEY($80000004), 16 rrKeyCurrentConfig = HKEY($80000005), 17 rrKeyDynData = HKEY($80000006)); 11 TRegistryRoot = (rrKeyClassesRoot, rrKeyCurrentUser, rrKeyLocalMachine, 12 rrKeyUsers, rrKeyPerformanceData, rrKeyCurrentConfig, rrKeyDynData); 18 13 19 14 { TRegistryContext } … … 23 18 Key: string; 24 19 class operator Equal(A, B: TRegistryContext): Boolean; 20 function Create(RootKey: TRegistryRoot; Key: string): TRegistryContext; overload; 21 function Create(RootKey: HKEY; Key: string): TRegistryContext; overload; 25 22 end; 26 23 … … 43 40 end; 44 41 45 function RegContext(RootKey: HKEY; Key: string): TRegistryContext; 46 42 const 43 RegistryRootHKEY: array[TRegistryRoot] of HKEY = (HKEY_CLASSES_ROOT, 44 HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_PERFORMANCE_DATA, 45 HKEY_CURRENT_CONFIG, HKEY_DYN_DATA); 47 46 48 47 implementation 49 48 50 function RegContext(RootKey: HKEY; Key: string): TRegistryContext;51 begin52 Result.RootKey := RootKey;53 Result.Key := Key;54 end;55 49 56 50 { TRegistryContext } … … 59 53 begin 60 54 Result := (A.Key = B.Key) and (A.RootKey = B.RootKey); 55 end; 56 57 function TRegistryContext.Create(RootKey: TRegistryRoot; Key: string): TRegistryContext; 58 begin 59 Result.RootKey := RegistryRootHKEY[RootKey]; 60 Result.Key := Key; 61 end; 62 63 function TRegistryContext.Create(RootKey: HKEY; Key: string): TRegistryContext; 64 begin 65 Result.RootKey := RootKey; 66 Result.Key := Key; 61 67 end; 62 68
Note:
See TracChangeset
for help on using the changeset viewer.