Re: TInifile.ReadSection does not read values



Thanks, I found out that TInifile.ReadSection calls the WinAPI
GetPrivateProfileString(). This API has a parameter called FFilename filled
with 'jaeger2koptor.ini'. This wasn't enough: I had to specify the entire
path to make sure that GetPrivateProfileString() would return 'true'.
So after I changing the constant 'inif' to
"V:\SectorApplicaties\Personen\Jaeger2Koptor\jaeger2koptor.ini", the program
did run correctly This is what the program looks right now:

const
inif = 'V:\SectorApplicaties\Onderwerpen\Jaeger2Koptor\jaeger2koptor.ini';
var
Ini: TInifile;
ii: integer;

begin
if FileExists(inif) then begin
Ini := TInifile.Create(inif);
Ini.ReadSection('Conversie', memo1.Lines);
for ii := 0 to memo1.Lines.Count-1 do
showmessage(memo1.Lines[ii]);
end
end;



"Maarten Wiltink" <maarten@xxxxxxxxxxxxxxxxxx> wrote in message
news:4423c959$0$11075$e4fe514c@xxxxxxxxxxxxxxxxx
"Shiva" <lunatic@xxxxxxxxxxx> wrote in message
news:e00ftl$eg4$1@xxxxxxxxxxxxxxxx
[...]
For some reason, memo1.lines has not been filled after executing the
line "Ini.ReadSection('Conversie', memo1.Lines)" (I stepped through
the code to make sure it executed this command iow the inifile exists!).
So why is that?

That, I don't know. But you could try compiling with debug DCUs and
stepping through ReadSection. It's fairly small, mainly some clerical
wrapping around a WinAPI function that may or may not do exactly what
you expect. MSDN can tell you what it does.

Groetjes,
Maarten Wiltink




.