Changeset 538
- Timestamp:
- Aug 6, 2019, 1:55:55 PM (5 years ago)
- Location:
- Registry
- Files:
-
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
Registry/Demo/RegistryDemo.lpi
r408 r538 1 <?xml version="1.0" ?>1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <CONFIG> 3 3 <ProjectOptions> 4 <Version Value=" 9"/>4 <Version Value="11"/> 5 5 <PathDelim Value="\"/> 6 6 <General> … … 15 15 <EnableI18N LFM="False"/> 16 16 </i18n> 17 <VersionInfo>18 <StringTable ProductVersion=""/>19 </VersionInfo>20 17 <BuildModes Count="1"> 21 18 <Item1 Name="Default" Default="True"/> … … 23 20 <PublishOptions> 24 21 <Version Value="2"/> 25 <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>26 <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>27 22 </PublishOptions> 28 23 <RunParams> 29 <local> 30 <FormatVersion Value="1"/> 31 </local> 24 <FormatVersion Value="2"/> 25 <Modes Count="1"> 26 <Mode0 Name="default"/> 27 </Modes> 32 28 </RunParams> 33 29 <RequiredPackages Count="2"> 34 30 <Item1> 35 31 <PackageName Value="GeneralRegistry"/> 32 <DefaultFilename Value="..\GeneralRegistry.lpk" Prefer="True"/> 36 33 </Item1> 37 34 <Item2> … … 43 40 <Filename Value="RegistryDemo.lpr"/> 44 41 <IsPartOfProject Value="True"/> 45 <UnitName Value="RegistryDemo"/>46 42 </Unit0> 47 43 <Unit1> … … 51 47 <HasResources Value="True"/> 52 48 <ResourceBaseClass Value="Form"/> 53 <UnitName Value="UFormMain"/>54 49 </Unit1> 55 50 <Unit2> … … 59 54 <HasResources Value="True"/> 60 55 <ResourceBaseClass Value="DataModule"/> 61 <UnitName Value="UCore"/>62 56 </Unit2> 63 57 </Units> … … 85 79 </Options> 86 80 </Linking> 87 <Other>88 <CompilerMessages>89 <MsgFileName Value=""/>90 </CompilerMessages>91 <CompilerPath Value="$(CompPath)"/>92 </Other>93 81 </CompilerOptions> 94 82 <Debugging> -
Registry/Demo/UCore.lfm
r392 r538 2 2 OnCreate = DataModuleCreate 3 3 OldCreateOrder = False 4 Height = 233 5 HorizontalOffset = 428 6 VerticalOffset = 172 7 Width = 275 4 Height = 291 5 HorizontalOffset = 535 6 VerticalOffset = 215 7 Width = 344 8 PPI = 120 8 9 object ActiveRegistry: TGeneralRegistry 9 left = 4210 top = 1 1310 left = 53 11 top = 141 11 12 end 12 13 end -
Registry/Demo/UCore.pas
r392 r538 31 31 procedure TCore.DataModuleCreate(Sender: TObject); 32 32 begin 33 TWinRegistry(ActiveRegistry.Backend).OpenKey('\Software\Chronosoft\RegistryDemo', True); 33 34 end; 34 35 -
Registry/Demo/UFormMain.lfm
r408 r538 1 1 object FormMain: TFormMain 2 Left = 2223 Height = 4544 Top = 1625 Width = 7072 Left = 354 3 Height = 568 4 Top = 285 5 Width = 884 6 6 Caption = 'General registry editor' 7 ClientHeight = 435 8 ClientWidth = 707 7 ClientHeight = 543 8 ClientWidth = 884 9 DesignTimePPI = 120 9 10 Menu = MainMenu1 10 11 OnShow = FormShow 11 LCLVersion = ' 1.1'12 LCLVersion = '2.0.2.0' 12 13 object StatusBar1: TStatusBar 13 14 Left = 0 14 Height = 2 015 Top = 41516 Width = 70715 Height = 28 16 Top = 515 17 Width = 884 17 18 Panels = <> 19 ParentFont = False 18 20 end 19 21 object TreeView1: TTreeView 20 22 Left = 0 21 Height = 41523 Height = 515 22 24 Top = 0 23 Width = 2 2425 Width = 280 24 26 Align = alLeft 25 DefaultItemHeight = 1627 ParentFont = False 26 28 TabOrder = 1 27 29 end 28 30 object Splitter1: TSplitter 29 Left = 2 2430 Height = 41531 Left = 280 32 Height = 515 31 33 Top = 0 32 Width = 534 Width = 6 33 35 end 34 36 object ListView1: TListView 35 Left = 2 2936 Height = 41537 Left = 286 38 Height = 515 37 39 Top = 0 38 Width = 47840 Width = 598 39 41 Align = alClient 40 42 Columns = < 41 43 item 42 44 Caption = 'Name' 43 Width = 1 5045 Width = 188 44 46 end 45 47 item 46 48 Caption = 'Type' 47 Width = 1 5049 Width = 188 48 50 end 49 51 item 50 52 Caption = 'Value' 51 Width = 1 0053 Width = 125 52 54 end> 53 55 OwnerData = True 56 ParentFont = False 54 57 ReadOnly = True 55 58 RowSelect = True … … 59 62 end 60 63 object MainMenu1: TMainMenu 61 left = 1 2862 top = 7264 left = 160 65 top = 90 63 66 object MenuItem1: TMenuItem 64 67 Caption = 'File' … … 72 75 end 73 76 object ActionList1: TActionList 74 left = 1 2875 top = 1 2877 left = 160 78 top = 160 76 79 object AImport: TAction 77 80 Caption = 'Import' … … 89 92 Caption = 'Modify connection' 90 93 end 94 object AValueAdd: TAction 95 Caption = 'Add' 96 OnExecute = AValueAddExecute 97 end 98 object AValueDelete: TAction 99 Caption = 'Delete' 100 end 101 object AValueEdit: TAction 102 Caption = 'Edit' 103 end 104 end 105 object PopupMenu1: TPopupMenu 106 left = 492 107 top = 177 108 object MenuItem4: TMenuItem 109 Action = AValueAdd 110 end 111 object MenuItem5: TMenuItem 112 Action = AValueEdit 113 end 114 object MenuItem6: TMenuItem 115 Action = AValueDelete 116 end 91 117 end 92 118 end -
Registry/Demo/UFormMain.pas
r392 r538 17 17 AConnectionDelete: TAction; 18 18 AConnectionModify: TAction; 19 AValueAdd: TAction; 20 AValueEdit: TAction; 21 AValueDelete: TAction; 19 22 AImport: TAction; 20 23 AExport: TAction; … … 25 28 MenuItem2: TMenuItem; 26 29 MenuItem3: TMenuItem; 30 MenuItem4: TMenuItem; 31 MenuItem5: TMenuItem; 32 MenuItem6: TMenuItem; 33 PopupMenu1: TPopupMenu; 27 34 Splitter1: TSplitter; 28 35 StatusBar1: TStatusBar; 29 36 TreeView1: TTreeView; 37 procedure AValueAddExecute(Sender: TObject); 30 38 procedure FormShow(Sender: TObject); 31 39 procedure ListView1Data(Sender: TObject; Item: TListItem); … … 33 41 function RegValueToString(Name: string): string; 34 42 procedure LoadNode(Node: TTreeNode; Key: TRegKey); 43 procedure ReloadTreeNode(Node: TTreeNode; Reg: TGeneralRegistry); 35 44 public 36 45 procedure ReloadValues; … … 75 84 ReloadKeys; 76 85 ReloadValues; 86 end; 87 88 procedure TFormMain.AValueAddExecute(Sender: TObject); 89 begin 90 // Core.ActiveRegistry.Write; 77 91 end; 78 92 … … 120 134 end; 121 135 136 procedure TFormMain.ReloadTreeNode(Node: TTreeNode; Reg: TGeneralRegistry); 137 var 138 Keys: TStrings; 139 I: Integer; 140 NewNode: TTreeNode; 141 begin 142 Keys := TStringList.Create; 143 Reg.GetKeyNames(Keys); 144 for I := 0 to Keys.Count - 1 do begin 145 NewNode := Node.TreeNodes.AddChild(Node, Keys[I]); 146 Reg.OpenKey(Keys[I], False); 147 ReloadTreeNode(NewNode, Reg); 148 end; 149 Keys.Free; 150 end; 151 122 152 procedure TFormMain.ReloadKeys; 123 153 var 124 154 NewNode: TTreeNode; 125 155 begin 156 TreeView1.Items.Clear; 126 157 NewNode := TreeView1.Items.AddChild(nil, 'Local computer'); 158 ReloadTreeNode(NewNode, Core.ActiveRegistry); 159 NewNode.Expand(True); 127 160 end; 128 161 -
Registry/GeneralRegistry.lpk
r408 r538 1 <?xml version="1.0" ?>1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <CONFIG> 3 3 <Package Version="4"> 4 4 <Name Value="GeneralRegistry"/> 5 <Type Value="RunAndDesignTime"/> 5 6 <Author Value="Chronos (robie@centrum.cz)"/> 6 7 <CompilerOptions> … … 9 10 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 10 11 </SearchPaths> 11 <Other>12 <CompilerMessages>13 <MsgFileName Value=""/>14 </CompilerMessages>15 <CompilerPath Value="$(CompPath)"/>16 </Other>17 12 </CompilerOptions> 18 13 <Description Value="Generalized registry classes for multiplatform programming."/> 19 14 <License Value="LGPL"/> 20 15 <Version Minor="1"/> 21 <Files Count="4"> 22 <Item1> 23 <Filename Value="WinRegistry.pas"/> 24 <Type Value="Text"/> 25 <UnitName Value="WinRegistry"/> 26 </Item1> 27 <Item3> 16 <Files Count="2"> 17 <Item2> 28 18 <Filename Value="UGeneralRegistry.pas"/> 29 19 <HasRegisterProc Value="True"/> 30 20 <UnitName Value="UGeneralRegistry"/> 31 </Item3> 32 <Item4> 33 <Filename Value="UTest.pas"/> 34 <UnitName Value="UTest"/> 35 </Item4> 21 </Item2> 36 22 </Files> 37 <Type Value="RunAndDesignTime"/>38 23 <RequiredPkgs Count="1"> 39 24 <Item1> -
Registry/GeneralRegistry.pas
r408 r538 5 5 unit GeneralRegistry; 6 6 7 {$warn 5023 off : no warning about unused units} 7 8 interface 8 9 9 10 uses 10 UGeneralRegistry, UTest,LazarusPackageIntf;11 UGeneralRegistry, LazarusPackageIntf; 11 12 12 13 implementation -
Registry/UGeneralRegistry.pas
r392 r538 6 6 7 7 uses 8 Classes, SysUtils, IniFiles, XMLRead, XMLWrite, DOM 9 {$IFDEF Windows} 10 , WinRegistry 11 {$ENDIF}; 8 Classes, SysUtils, IniFiles, XMLRead, XMLWrite, DOM, Registry; 12 9 13 10 type … … 246 243 function TWinRegistry.GetKeyInfo(var Value: TRegKeyInfo): Boolean; 247 244 var 248 KeyInfo: WinRegistry.TRegKeyInfo;245 KeyInfo: Registry.TRegKeyInfo; 249 246 begin 250 247 Result := Registry.GetKeyInfo(KeyInfo); … … 262 259 function TWinRegistry.GetValueInfo(const Name: string; var Value: TRegValueInfo): Boolean; 263 260 var 264 ValueInfo: WinRegistry.TRegDataInfo;261 ValueInfo: Registry.TRegDataInfo; 265 262 begin 266 263 Result := Registry.GetDataInfo(Name, ValueInfo); … … 399 396 400 397 procedure TWinRegistry.GetKeyNames(Strings: TStrings); 398 var 399 I: Integer; 401 400 begin 402 401 Registry.GetKeyNames(Strings); 402 // for I := 0 to Strings.Count - 1 do 403 // Strings[I] := AnsiToUtf8(Strings[I]); 403 404 end; 404 405 … … 687 688 {$IFDEF Windows} 688 689 Backend := TWinRegistry.Create; 689 //TWinRegistry(Backend).RootKey := HKEY_CURRENT_USER; 690 //TWinRegistry(Backend).BaseKey := 'Software\' + CompanyName + '\' + 691 // ApplicationName; 690 TWinRegistry(Backend).CurrentRoot := HKEY_CURRENT_USER; 691 TWinRegistry(Backend).CurrentKey := 'Software\Company\' + 692 ApplicationName; 693 // TWinRegistry(Backend).CurrentKey := 'Software\' + VendorName + '\' + 694 // ApplicationName; 692 695 {$ENDIF} 693 696 {$IFDEF Linux}
Note:
See TracChangeset
for help on using the changeset viewer.