Autor Beitrag
D. Annies
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Mo 29.10.07 18:51 
Hi, Delpher,

was mache ich falsch?
Nach 10 Minuten "Nichtstun" soll der timer1 diese Proc aufrufen, die Fehlermeldung heißt:
"EAccessViolationError, Zugriffsverletzung bei Adresse 00515FEE in modul x.exe, Lesen von Adresse 00000000"

Der Code:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure TForm1.Timer1Timer(Sender: TObject);
var tempform : Tform;
begin
  if form1.bitbtn1.Visible = false then
  begin
    if home[length(home)] <> '/' then home := home + '/';
    bild := TJPEGImage.create; bild.loadfromfile(home + 'Schluessel.jpg');
    tempform := Tform.Create(self); tempform.WindowState := wsmaximized;
    tempform.Visible := true;
    image3.Parent := tempform;  // <--- Da kommt der obige Fehler
      image3.Picture.Graphic := bild; image3.setbounds(10,10,980,680);
    Image3.Visible := true;
//    application.MessageBox('(wegen Zeitüberschreitung!)', 'Neuanmeldung');
    messagedlgpos('Zeitüberschreitung!', mtInformation, [mbOk], 0,450,530);
    tempform.Free;
    form1.passwd(self);
  end
  else form1.bitbtn1click(self);
end;


Wer kann da weiterhelfen? (Hoffe, die Angaben reichen)

Gruß,
Detlef A.
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: Mo 29.10.07 19:01 
Hi

versuchs mal mit assign bei der Zuweisung, statt :=

Gruß

Aga

_________________
Gruß Aga
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Mo 29.10.07 19:46 
Hi, Aga,

ist es so: image3.Assign(tempform);

und muss ich schreiben: tempform.release statt tempform.free?

gruß, Detlef
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: Mo 29.10.07 21:10 
hi

ware gerade wa kurz angebunden, weil der Feierabend lockte :wink:

image3.Parent.assign(tempform);

Voraussetzung natürlich, daß image3 auch wirklich ein Form als Parent hat und nicht in irgendeinem anderen Container steckt.

In der Delphi-Hilfe steht, man sollte form.release aufrufen, statt form.free.

Letzteres geht zwar auch, aber wer weiß, wie sich die Memory-Belegung dann entwickelt.

Diese Methode sollte jedenfalls nicht aus einem eh des Forms heraus aufgerufen werden, das Form würde sofort zerstört und es gäbe keinen Rückkehrpunkt mehr.
Form.release dagegen arbeitet noch alles ab und gibt dann erst den Speicher frei.

_________________
Gruß Aga
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Mo 29.10.07 21:46 
Hi, Aga,

leider noch nicht richtig! Fehlermeldung: Form1 kann nicht Tform1 zugewiesen werden.

P.S. Image3 liegt auf Form1.

Gruß, Detlef
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: Mo 29.10.07 22:41 
hi

tjo, hab nur geraten, weil ich noch nie auf die Idee gekommen bin, oder die Notwendigkeit verspürt habe, die Eigenchaften eines Forms aus ein anderes zu übertragen.
Kann auch sein, daß das gar nicht geht, weil Form ist ja schon was sehr Großes, auf API-Ebene sind das zwar alles nur Fenster, aber für die VCL mag das anders aussehen.

Was mir jetzt nicht klar ist, was Du überhaupt erreichen willst.
Ansatzweise spricht meine Glaskugel von einer Art Slideshow, die sofern nicht innerhalb eines Timerintervalls ein Button gedrückt wird, alleine weitermacht.

Sollte sie recht haben, wäre es dann nicht sinnvoller ein Formular zu haben und lediglich immer die Bilder auszutauschen?

_________________
Gruß Aga
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Mo 29.10.07 23:37 
Hi, Aga,

es ist nur ein Bild, was auf Form1 liegt und bei Bedarf nach Tempform gegeben wird.

Danke erstmal für deine Mühe, vlt hat ja noch jemand anderer eine Idee?

Gruß, Detlef
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: Mo 29.10.07 23:45 
hihi

da hättete dann aber schon einen Mathematiker-Fehler drin :mrgreen:

eine Zuweisung ist keine Gleichung, heißt die beiden Seiten sind nicht gleich.

tempform.assign(image3.Parent) so habe ich es auch probiert, wird dadurch aber auch nicht besser, also wenn sonst keiner eine Lösung hat, definier auch ein image in tempform und mach dann die Zuweisung über assign.
Aber über das Image, nicht das Form-Objekt.

_________________
Gruß Aga
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Di 30.10.07 08:50 
Hi, Aga,

mal sehen, wie ich das hinkriege (hab noch keine Idee ...)

Danke erstmal,
Detlef
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 30.10.07 09:00 
Mein Gott, was tust Du da??? Das verursacht Augenkrebs!

Was willste denn in der Routine eigentlich genau tun?

Soweit ich das seh, erzeugst Du ne Form, wo Du'n Image drauf legst und diese Form danach wieder freigibst ...

Genaue Beschreibungen von dem, was man tun möchte, haben noch keinem geschaded ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Di 30.10.07 11:46 
hi, Benny,

ist richtig, und dann wird das Passwort neu eingegeben!
Das Bild dient also nur als "Hintergrund für die Message.

Ist dein Augenkrebs jetzt schon geheilt? - sonst gute Besserung... :lol:

Detlef
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 30.10.07 18:34 
Schau Dir ggf. mal die Funktion CreateMessageDialog an.

Das Bild dort austauschen kannst Du mit FindComponent('Image'), den Dialog anzeigen mit ShowModal;

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Di 30.10.07 19:12 
Hi, Benny,

danke für deine Antwort, ich guck mir das mal an ... :lupe:

Gruß, Detlef