Autor Beitrag
Hendi48
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Mi 25.04.07 18:58 
Hi, ich habe mal wieder ein Problem.
Weil der Load knopf direkt über dem Save knopf ist, habe ich mich verklickt und meine INI abgeschossen.
Damit das nicht noch einmal passiert, möchte ich dass das Programm mich jedesmal warnt, das es die INI schon gibt und ob man sie überschreiben will.
Ich habe leider noch nie eine Meldung anzeigen lassen und weiß nicht wo die Funktion hinkommt.
Ich weiß nur das da irgendwie Messagedlg, Mryes und Mrcancel dadrin vorkommt
Kann mir jemand helfen? :?:
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mi 25.04.07 19:01 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
var
  Ret: Integer;
begin
  Ret := mrYes;

  if FileExists('...') then
    Ret := MessageDlg('Überschreiben?', mtConfirmation, [mbYes, mbNo], 0);

  if (Ret = mrYes) then
  begin
    // Überschreibe
  end;
end

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Hendi48 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Mi 25.04.07 19:10 
danke für die schnelle Antwort aber jetz kommt: ; expected but 'VAR' found

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
procedure TForm1.Save1Click(Sender: TObject);
var
  Ret: Integer;
begin
  Ret := mrYes;


  if FileExists('C:\Users\Hendrik\plan.ini') then
    Ret := MessageDlg('Überschreiben?', mtConfirmation, [mbYes, mbNo], 0);


  if (Ret = mrYes) then
  begin
    // Überschreibe
  end;
 end
var
  Ini: TIniFile;
begin
try
    Ini:=TIniFile.Create('C:\Users\Hendrik\plan.ini'); //Vista-Pfad
    Ini.WriteString('Bereich1','Schlüssel1',Edit1.text);
   //usw.
Saubäär
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 376



BeitragVerfasst: Mi 25.04.07 19:34 
Tja du, da würd ich die Variable mal ganz fix da deklarieren, wo sie hin gehört!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Save1Click(Sender: TObject);
var
  Ret: Integer;
  Ini: TIniFile;
begin
  Ret := mrYes;
...


Gruß
Hendi48 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Mi 25.04.07 19:49 
ok, vielen dank für die hilfe, es geht jetzt! :D