Autor Beitrag
chriss1988
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 389

windows xp prof,home,windows98
delphi5
BeitragVerfasst: Do 08.06.06 10:43 
hi
wollte für mein memory eine highscoreliste schreiben und da kam der begrif ini
hab mich en bissl schlau gamacht hab da auch en tutorial gefunden und hab mich dran gemacht sowas für mein spiel zu schreiben.

Folgender maßen soll das aussehn

1. habe in einer form 4 ein memo
2. wenn das spiel vorbei ist und ich auf den button1 click soll er die züge und punkte in das memo schreiben und dort speichern.
3. drücke ich auf den button2 soll er mir die form4 aufrufen und die liste anzeigen.


bei mir geht das net ka warum kann mr da einer bitte weiterhelfen undmein code so ändern das er geht?

ausblenden volle Höhe 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:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
   
private    { Private declarations }
      procedure Read_Registry;
      procedure Write_Registry;

public     { Public declarations }
      
    FIniFile: TRegIniFile;
      
  end;

const
  SECTION = 'Sample';

procedure TForm1.FormCreate(Sender: TObject);
begin
    FIniFile := TRegIniFile.Create('Sample Registry');
end;




procedure TForm1.FormDestroy(Sender: TObject);
var
  Cleanup: TRegistry;
  key: string;
begin
  key := FIniFile.FileName;
  FIniFile.Free;

  
  Cleanup := TRegistry.Create;
  try
    Cleanup.DeleteKey(key);
  finally
    Cleanup.Free;
  end;

end;


procedure TRegIniForm.Write_Registry;
begin
  FIniFile.WriteInteger(SECTION, 'moves', emoves.text);
  FIniFile.WriteInteger(SECTION, 'Points', epoints.text);


  if not Button2.Enabled then Button2.Enabled := True;
end;

procedure TRegIniForm.Read_Registry;
begin
  emoves.text:= FIniFile.ReadInteger(SECTION, 'Zuege', False);
  epoints.text := FIniFile.ReadInteger(SECTION, 'Punkte', 0);


  Memo_Read.Lines.Clear;
  FIniFile.ReadSectionValues(SECTION, Memo_Read.Lines);

  Button2.Enabled := False;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
 Write_Registry;
end;



procedure TForm1.Button2Click(Sender: TObject);
begin
 read_Registry;
end;

end.


der fehler liegt darin das er sagt
ausblenden Delphi-Quelltext
1:
[Fehler] Unit1.pas(146): Undefinierter Bezeichner: 'TRegIniFile'					


also kann mir da einer helfen ?

danke
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Do 08.06.06 10:49 
Öhmm, das is ja heiß, du schreibst in nen neuen Schlüssel in der Registry, bist du dir dessen bewusst?
wäre es nicht ausreichen einfach nur TInifiles zu benutzen??
Ansonsten bei den Uses mal TRegIniFiles einbinden

MfG Fighter#1

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
chriss1988 Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 389

windows xp prof,home,windows98
delphi5
BeitragVerfasst: Do 08.06.06 10:52 
ehm ka das stand so auf irgendner seite und ich hab das umgeformt. habe wenn ich ganz ehrlich bin auch kp wie man ne ini macht deshalb frag ich ja ob mir das einer ändern kann
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 08.06.06 10:52 
Ich würde dir auch empfehlen, TIniFile statt TRegIniFile zu verwenden. Es wird von vielen nicht so gerne gesehen, wenn in der Registry rumgefummelt wird. :wink:
Vor allem, wenn du noch in der Experimentierphase bist.
chriss1988 Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 389

windows xp prof,home,windows98
delphi5
BeitragVerfasst: Do 08.06.06 10:56 
also muss ich überall wo regestry vorkommt IniFile einsetzten?
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Do 08.06.06 11:03 
Ich glaube das wird dir Weiterhelfen : www.delphi-library.d...mp;highlight=inifile

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
chriss1988 Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 389

windows xp prof,home,windows98
delphi5
BeitragVerfasst: Do 08.06.06 11:27 
also ich lass das glaub ich ich versteh das net