Autor Beitrag
Anarkids
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 81

Win XP Pro, Freundin
Delphi 2006, C/C++, VisualBasic
BeitragVerfasst: Di 04.04.06 10:25 
hi leute.

ich habe ein problem beim auslesen meiner ini-datei. hier mal der text:

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:
//aus unit1.form1

rocedure TForm1.load(Sender: TObject);
begin
  stringgrid1.cells[1,0]:='HTTP';
  stringgrid1.cells[2,0]:='SMTP';
  stringgrid1.Cells[3,0]:='FTP';
  stringgrid1.cells[4,0]:='POP3';
  stringgrid1.cells[5,0]:='HTTPS';

  i:=1;
  try
  stringgrid1.Cells[0,i]:=ini.ReadString('t-online','Name','Name');
  finally
  ini.free;
  end;

end;

procedure TForm1.Button1Click(Sender: TObject);
var ports : array [1..5of String;
    Sock : TTCPClient;
begin
  Ports[1] := '80';
  Ports[2] := '119';
  Ports[3] := '21';
  Ports[4] := '110';
  Ports[5] := '443';
  Sock := TTCPClient.Create(self);
  Sock.RemoteHost := edit1.text;

  if l = 0 then l := 1;

  i:=1;
  memo1.Lines.add(Sock.LookupHostAddr(Sock.RemoteHost) + ' Connecting...');
  memo1.Lines.add('>');
  repeat
    Sock.RemotePort := Ports[i];
    Sock.OnConnect := ActiveConnection;
    Sock.OnError := SocketError ;
    Sock.Active := True;
    Application.ProcessMessages;
    Sock.Active := False;
    i := i + 1;
  until i = 6;
  Sock.Free;
  l:=l+1;
  memo1.Lines.add('Done.');
  memo1.Lines.add('-------------------------------');
end;

//aus unit2.form2
procedure TForm2.Button2Click(Sender: TObject);
 var ini: TIniFile;
begin
  ini:=TIniFile.create(ExtractFilePath(ParamStr(0))+
    'einstellungen.ini');

  ini.writestring(name1.text,'Name',name1.text);
  ini.WriteString(name1.text,'URL',URL.text);
  ini.WriteString(name1.text,'BEM',BEM.text);

  if CH_HTTP.Checked then ini.Writestring(name1.text,'HTTP','80');
  if CH_SMTP.Checked then ini.writestring(name1.text,'SMTP','25');
  if CH_FTP.Checked then ini.writestring(name1.text,'FTP','21');
  if CH_HTTPS.Checked then ini.writestring(name1.Text,'HTTPS','443');
  if CH_POP3.Checked then ini.writestring(name1.text,'POP3','110');

  ini.free;
  form2.hide;
end;


die fehlermeldung erscheint direkt beim starten des progs:
Zugriffsverletzung bei Adresse 0046C4A5 in Modul 'Projekt1.exe'

ich hab absolut kein plan, wieso sowas immer mir passiert :(

_________________
Mr.D
Change begins with you - TODAY!
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Di 04.04.06 10:30 
bin mir nicht sicher, aber ist es möglich, dass du

user profile iconAnarkids hat folgendes geschrieben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
rocedure TForm1.load(Sender: TObject);
 [...]  try
  stringgrid1.Cells[0,i]:=ini.ReadString('t-online','Name','Name');
  finally
  ini.free;
  end;
(


aus der ini liest und sie freigibst, ohne sie vorher überhaupt zu öffnen? also erst noch

ausblenden Delphi-Quelltext
1:
  ini:=TIniFile.create(ExtractFilePath(ParamStr(0))+'einstellungen.ini');					


da hin muss?
Anarkids Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 81

Win XP Pro, Freundin
Delphi 2006, C/C++, VisualBasic
BeitragVerfasst: Di 04.04.06 10:41 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
i:=1;
  ini:=Tinifile.Create(ExtractFilePath(Application.ExeName)+'einstellungen.ini');
  try
  stringgrid1.Cells[0,i]:=ini.ReadString('t-online','Name','-');
  finally
  ini.free;
  end;


schon gefunden ;-) danke dir trotzdem!!!

_________________
Mr.D
Change begins with you - TODAY!
Anarkids Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 81

Win XP Pro, Freundin
Delphi 2006, C/C++, VisualBasic
BeitragVerfasst: Di 04.04.06 11:32 
so ich hab noch ein neues problem und zwar:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
ini:=Tinifile.Create(ExtractFilePath(Application.ExeName)+'einstellungen.ini');
  try
   setlength(names, 100);
   for h := low(names)  to high(names) do
   names[h]:=ini.ReadString('...','Name','-'); //ich möchte hier gern NUR die überschriften der abschnitte aus meiner ini-datei in den array "names" kopieren!!!
  finally
   ini.free;
  end;

_________________
Mr.D
Change begins with you - TODAY!