C:\Users\Bart\LazarusProjecten\bugs\Console\regini>rtest
Try 1: WFileName = "C:\Users\Bart\Desktop"
Try 2: WFileName = "C:\Users\Bart\Desktop"
Try 3: WFileName = "C:\Users\Bart\Desktop"
Yes Bart that works.But RegIniFile still is an IniFile after all. Would you do the same with TIniFile?
But not this, where the "Section"-name has been moved to the create path to keep subsequent calls of the same section simpler.
RegIni := TRegIniFile.Create('Software\MicroSoft\Windows\CurrentVersion\Explorer\Shell Folders'); for i := 1 to 3 do WFileName := RegIni.ReadString ('', 'Desktop', 'Failure!');
But RegIniFile still is an IniFile after all. Would you do the same with TIniFile?
TRegIniFile is a derivative of TRegistry, not of TInifile b.t.w.I do remember that in my Delphi days I had replaced TIniFile by TRegIniFile in order to easily store the settings to the registry without changing anything else. This must be the reason why I confused it.
B.t.w. Using TRegIniFile in modern times is a bit weird.Some of the tools used in our company are written in Delphi. One of them needs improvement, so I got the Delphi code and I got it conveted to Lazarus, but s.o. might try to merge my changes in the Delphi source (they do not have a license for me, AFAIK it is extremely expensive).
Thanks, so I will just have to wait, until there is an official release with the fix.
Some of the tools used in our company are written in Delphi. One of them needs improvement, so I got the Delphi code and I got it conveted to Lazarus
You don't have to wait as you could:Thanks, I would do it in the older days, when I was much more aware and dependent on Lazarus.
1) Download the source and compile the FPC fixes 3.2 branch; or
2) Patch the FPC 3.2.0 release and re-compile.
..
Why do you think this is wrong? TRegIniFile is like an ini file, only inside the registry. When you create a TIniFile you create a file with the name given as parameter; when you create a TRegInifile you create a node inside the registry with the name given as parameter. When you write a string to TInifile you have the first parameter as section inside the ini, and the second parameter is the value below this section. The same with TRegIniFile: it adds a node with the name of the first parameter and an item from the second parameter as value.It creates in HKEY_CURRENT_USER a key (folder) fpc_reginifile_test, and another subkey fpc_reginifile_test in it and inside it creates two subkeys aSection and aOtherSection.
uses ...registry; ... procedure TForm1.Button1Click(Sender: TObject); var Ini: TRegIniFile; begin Ini := TRegIniFile.Create('fpc_reginifile_test'); Ini.WriteString('aSection', 'aIdent', 'aValue'); Ini.WriteSTring('aOtherSection','aOtherIdent','aOtherValue'); Ini.Free; end;
This does not seem okay to me?
-fpc_reginifile_test
|-fpc_reginifile_test
|-aSection
|-aOtherSection
Notice the double "fpc_reginifile_test".Right, I did not notice that...