Autor Beitrag
DiamondDog
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Fr 11.07.08 09:24 
Hallo Leute,
wie der Titel schon sagt hab ich Probleme beim laden und Speichern in eine ini Datei.
Also beim öfnen der Form wird aus der ini nicht geladen und wenn ich die Form,
mit speichern schließen will dann kommt eine Zugriffsverletzung nur ich versteh nciht ganz wieso.
Kann mir vll jemand dabei Helfen den Fehler zu beheben?

Danke schon mal.

Mfg Dog


Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Fr 11.07.2008 um 11:58
Einloggen, um Attachments anzusehen!
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Fr 11.07.08 10:19 
Wo bitte ist das irgendwas vom Speichern in der INI??

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
DiamondDog Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Fr 11.07.08 10:38 
Sorry Falsche Datei angehängt.
Im Anhang jetzt die Richtige.
Einloggen, um Attachments anzusehen!
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Fr 11.07.08 10:49 
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:
{***********************************************************}
procedure TQipPlugin.LoadPluginOptions;
var aPluginSpecific: pPluginSpecific;
    ini:TIniFile;
begin
  FForm1:= TForm1.Create(nil);
  ini:=TIniFile.Create(ExtractFilePath(FDllPath)+'Options.ini');
  Ip:=ini.ReadString('main','Ip','');
  {getting plugin options record pointer}
  aPluginSpecific := FPluginSvc.PluginOptions(FPluginInfo.DllHandle);

  if Assigned(aPluginSpecific) then
  begin
    {loading options ...}
    FOptionBool1  := aPluginSpecific^.Bool1;
    FOptionParam2 := aPluginSpecific^.Param2;
  end;
  ini.Free;
end;

{***********************************************************}
procedure TQipPlugin.SavePluginOptions;
var aPluginSpecific: pPluginSpecific;
    ini:TIniFile;
begin
  ini:=TIniFile.Create(ExtractFilePath(FDllPath)+'\Options.ini');
  ini.WriteString('main','Ip',Ip);
  {getting plugin options record pointer}
  aPluginSpecific := FPluginSvc.PluginOptions(FPluginInfo.DllHandle);

  if Assigned(aPluginSpecific) then
  begin
    {saving options ...}
    aPluginSpecific^.Bool1  := FOptionBool1;
    aPluginSpecific^.Param2 := FOptionParam2;
  end;
  ini.Free;
end;


Warum da mit "\"?

ExtractFilePath gibt doch den Pfad schon mit "\" aus..

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: Fr 11.07.08 13:03 
user profile iconZeitGeist87 hat folgendes geschrieben:
Warum da mit "\"?
ExtractFilePath gibt doch den Pfad schon mit "\" aus..
:idea: Um solche und ähnliche "Fehler" leichter eingrenzen zu können, empfiehlt es sich, den Pfad-, bzw. Dateinamen in einem Edit-Feld ausgeben zu lassen.

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Fr 11.07.08 13:22 
user profile iconBlawen hat folgendes geschrieben:
user profile iconZeitGeist87 hat folgendes geschrieben:
Warum da mit "\"?
ExtractFilePath gibt doch den Pfad schon mit "\" aus..
:idea: Um solche und ähnliche "Fehler" leichter eingrenzen zu können, empfiehlt es sich, den Pfad-, bzw. Dateinamen in einem Edit-Feld ausgeben zu lassen.


Oder gleich mit IncludeTrailingPathDelmiter...

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
DiamondDog Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Fr 11.07.08 14:12 
Der "/" hat das Problem aber auch nicht behoben.
Immer noch das selbe beim Öffnen von der Form1 wird nichts geladen.
Und beim speichern kommt die diese Fehlermeldung:
Zugriffsverletzung bei Adresse 03073F7C in Modul 'DBox2.dll'. Schreiben von Adresse 00000040.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 11.07.08 14:35 
Hast du denn schon mal die elmentarsten Schritte unternommen, um den Fehler zu finden? Nicht relevanten Code auskommentiert, die Prozedur in Einzelschritten debuggt, Fehler eingegrenzt, ...
DiamondDog Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Fr 11.07.08 15:08 
Also wenn ich den Code zum Laden und Speichern ausbaue,
dann Funtkioniert alles so wie es soll.
Hab auch mit:
ausblenden Delphi-Quelltext
1:
ShowMessage(ExtractFilePath(FDllPath));					
den Pfad kontroliert und auch dieser ist ok.
Also wüste jetzt nicht mehr wirklich wo noch der Fehler liegen könnte.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Fr 11.07.08 15:35 
hast du überprüft ob du schreibrechte hast??

hast du überprüft ob die sections / values existieren?

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
DiamondDog Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Fr 11.07.08 16:18 
Schreib rechte hab ich.

Und wie kann ich den prüfen ob die sections / values existieren?
Tilman
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1405
Erhaltene Danke: 51

Win 7, Android
Turbo Delphi, Eclipse
BeitragVerfasst: Fr 11.07.08 16:22 
Wenn du die INI erfolgreich abspeicherst existieren sie. Ich vermute aber dass schon das speichern bei dir nicht funzt oder?

_________________
Bringe einen Menschen zum grübeln, dann kannst du heimlich seinen Reis essen.
(Koreanisches Sprichwort)
DiamondDog Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Fr 11.07.08 16:47 
Nein das Laden wie auch das Speichern funktioniert nicht beim laden,
passiert einfach nichts als würde die Zeile ignoriert und beim Speichern kommt die Zugriffsverletzung wie oben schon gesagt.
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Fr 11.07.08 16:56 
Leg mal die INI händisch an!

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
DiamondDog Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Fr 11.07.08 17:53 
Ich habs jetzt mal direckt gemacht das funktioniert:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TQipPlugin.LoadPluginOptions;
[...]
FForm1.Edit2.Text:=ini.ReadString('main','Ip','');
[...]
und so beim Laden nur das bekomme ich immer noch eine Zugriffsverletzung.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TQipPlugin.SavePluginOptions;
[...]
ini.WriteString('main','Ip',FForm1.Edit2.Text);
[...]
war es vieleicht falsch Ip oben unter Public als string zu definieren?

Edit:
Hab das mal so getestet:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
ShowMessage('Save');
  ini:=TIniFile.Create(ExtractFilePath(FDllPath)+'Options.ini');
ShowMessage('Options.ini');
  ini.WriteString('main','Ip',FForm1.Edit2.Text);
ShowMessage('ini.Write');
  ini.Free;
ShowMessage('Free');
Also Die Massage Save zeigt er noch an danach kommt die Zugriffsverletzung.
DiamondDog Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Sa 12.07.08 17:06 
Hat den niemand ne Ide wieso ich nicht Speichern kann nur laden?
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Sa 12.07.08 17:54 
und wie schaut FDLLpath im Debugger aus?

Mach mal showmessage(FDllpath);!!

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
DiamondDog Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: So 13.07.08 10:33 
Pfad:
C:\Programme\QIP Infium\Plugins\DBox2\DBox2.dll

Also der Pfad stimmt.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 13.07.08 10:43 
ausblenden Delphi-Quelltext
1:
ini.WriteString('main','Ip',FForm1.Edit2.Text);					

Nimm mal FForm1 da raus und nimm stattdessen mal eine Variable.
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: So 13.07.08 13:38 
Vielleicht übersehe ich ja was, aber irgendwie passt da etwas nicht ganz zusammen:

Zitat:
ini:=TIniFile.Create(ExtractFilePath(FDllPath)+'Options.ini');


Zitat:
Mach mal showmessage(FDllpath);!!

--> Pfad: C:\Programme\QIP Infium\Plugins\DBox2\DBox2.dll


Irgendwie kommt aktuell bei dieser Variante "C:\Programme\QIP Infium\Plugins\DBox2\DBox2.dllOptions.ini" zustande...

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)


Zuletzt bearbeitet von Blawen am So 13.07.08 13:44, insgesamt 1-mal bearbeitet