Delphi-Quellcode:
procedure TForm1.FormShow(Sender: TObject);
var update: Integer;
Ini : TIniFile;
UserAppDataDir, ProgPath: String;
begin
UserAppDataDir := GetSpecialFolder(CSIDL_LOCAL_APPDATA);
if FileExists(UserAppDataDir + AppDataRootDir + AppDataProjectDir + '\Config.ini') then
begin
Ini := TIniFile.Create(UserAppDataDir + AppDataRootDir + AppDataProjectDir + '\Config.ini');
try
ComboBox1.ItemIndex := Ini.ReadInteger('Default', 'Channel', 1);
finally
ini.free;
end;
if DirectoryExists(UserAppDataDir + AppDataRootDir + AppDataProjectDir) then
begin
showmessage('Ja');
end else showmessage('Nein');
ProgPath := ExtractFilePath(ParamStr(0));
if FileExists(UserAppDataDir + AppDataRootDir + AppDataProjectDir + '\original.txt') then
begin
ListBox1.Items.LoadFromFile(UserAppDataDir + AppDataRootDir + AppDataProjectDir + '\original.txt');
end else ListBox1.Items.LoadFromFile(ProgPath + 'ersatz.txt');
end;
PS. Das mit deinem Vorschlag werde ich noch umsetzen.