Her er min kode:
unit Unit7;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, INIfiles, StdCtrls;
type
TForm7 = class(TForm)
ListBox1: TListBox;
procedure ListBox1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form7: TForm7;
implementation
uses Unit6;
{$R *.dfm}
procedure TForm7.ListBox1Click(Sender: TObject);
var
MyINI: TINIFile; // TINIFile objektet
PathToINIFile: String;
begin
PathToINIFile :=
IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)))+'test1.ini';
{Skab objektet}
MyINI := TINIFile.Create(PathToINIFile);
listbox1.Items.text := MyINI.ReadString('MinSektion', 'Startside', 'Ikke fundet');
end;
end.