Autor Beitrag
soisseteben
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 111

Win XP
D7
BeitragVerfasst: Mi 13.09.06 19:25 
Hallo erstmal,

Ich hab 'n sehr komisches Problem. In meinem Prog ist unter anderem ein Datenmodul, das ein Formular aufrufen soll. Copilieren klappt wunderbar, nur beim Anzeigen gibts ne Fehlermeldung von wegen "Zugriffsverletzung bei Adresse "0044usw" im Modul 'Projekt1.exe'. Fehler bei lesen von "000002F4"". Bin echt ratlos. Hatte ähnliche Konstellationen schon öfters und da hat es immer hingehauen... :(

Hier der (grobe) Source des Datenmoduls:

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:
unit Rechnen;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, StdCtrls, ExtCtrls;

type
  TDataModule2 = class(TDataModule)
    procedure DataModuleCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  DMRechnen: TDataModule2;

implementation

uses Oberflaeche, Hinzu;

{$R *.dfm}

procedure TDataModule2.DataModuleCreate(Sender: TObject);
begin
  //code..
  FHinzu.Show;  // hier bricht er ab
end;

end.


Und hier der der Formular-UNit:

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:
24:
25:
26:
27:
28:
29:
30:
unit Hinzu;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm2 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Memo1: TMemo;
    //usw...
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  FHinzu: TForm2;

implementation

uses Rechnen, Oberflaeche;

{$R *.dfm}

end.


und noch der der Projekt-Unit

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
program Project1;

uses
  Forms,
  Oberflaeche in 'Oberflaeche.pas' {Form1},
  Rechnen in 'Rechnen.pas' {DataModule2: TDataModule},
  Hinzu in 'Hinzu.pas' {Form2};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, FOberflaeche);
  Application.CreateForm(TDataModule2, DMRechnen);
  Application.CreateForm(TForm2, FHinzu);
  Application.Run;
end.


Wär echt nett, wenn jemand Rat wüsste.

Danke schonmal, Soisset
Raffo
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 300



BeitragVerfasst: Mi 13.09.06 19:28 
Hast Du mal in D "Suche nach Laufzeitfehler" geschaut? Was macht er im OnCreate von Hinzu, mach doch nen Breakpoint, ob er soweit kommt.
uwewo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 154



BeitragVerfasst: Mi 13.09.06 19:33 
Du versucht Dein Formular Hinzu anzuzeigen obwohl es noch nicht erstellt ist.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
begin  
  Application.Initialize;  
  Application.CreateForm(TForm1, FOberflaeche);    
   //hier bei TDatamodule.Create willst Du schon das Form Hinzu anzeigen
  Application.CreateForm(TDataModule2, DMRechnen); 
  Application.CreateForm(TForm2, FHinzu);  
  Application.Run;  
end.
soisseteben Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 111

Win XP
D7
BeitragVerfasst: Mi 13.09.06 20:00 
Tschuldigung wegen der späten Antwort. Also der Fehler liegt auf jeden Falle beim Aufruf von FHinzu.Show - also da wird die Fehlermeldung ausgelöst. Das mit der Suche nach den Laufzeitfehlern klappt nicht: Will ich suchen während das Prog läuft, sagt er das er das Fenster nicht öffnen kann und wenn ich das Programm beende, kann ich "Laufzeitfehler Suchen" nicht mehr anwählen...
:nixweiss:
soisseteben Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 111

Win XP
D7
BeitragVerfasst: Mi 13.09.06 20:02 
oh, hab ich glatt übersehen

Das wars gewesen, DANKE!! :D