Autor Beitrag
Jojojoxx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Do 30.08.07 20:05 
Hallo!

In meinem Programm Wird während des Form1.Oncreate-Ereignisses Code abgearbeitet.
Wenn man (während der Rechner noch an der Prozedur arbeitet) die Form minimiert und anschließend (ebenfalls während die Prozedur noch läuft) sie wieder öffnet erhalte ich eine Zugriffsverletzung (das Programm arbeitet aber weiter).
Sobald die Prozedur abgearbeitet ist, kann ich problemlos minimieren/öffnen. Ich kann den Code hier leider nicht posten, da er zu verzeweigt wäre mit diversen Prozeduren, sodass es nichts bringen würde, aber gibt es da denn typische "Fehler" oder Dinge, die nicht ins OnCreate gehören??
Danke euch!
mfg

Jojo
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 30.08.07 20:39 
Moin!

user profile iconJojojoxx hat folgendes geschrieben:
Wenn man (während der Rechner noch an der Prozedur arbeitet) die Form minimiert und anschließend (ebenfalls während die Prozedur noch läuft) sie wieder öffnet erhalte ich eine Zugriffsverletzung (das Programm arbeitet aber weiter).

An welcher Stelle im Code tritt denn die AV auf (zeigt dir doch der Debugger)? Mit so wenig Infos, wie du rausgegeben hast, kann man doch quasi nur raten... :nixweiss:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Do 30.08.07 21:00 
Hi!

Mehr als das hier erhalte ich nicht:
user defined image
Nach dem Klick auf OK, springt Delphi auch nicht zu einer Code-Zeile und markiert diese...
mfg

Jojo
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 30.08.07 21:05 
Moin!

Die niedrige Adresse lässt vermuten, dass du über einen NIL-Pointer zugreifst. Im FormCreate stehen die folgenden Formulare noch nicht zur Verfügung. Sicher, dass du nicht zufällig auf andere Formulare zugreifst? :nixweiss:

Pack das Zeug aus FormCreate doch mal nach FormShow! :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Do 30.08.07 21:30 
Wenns in OnShow ist sehe ich die Form während dem Prozedurablauf nicht und kann sie daher nicht minimieren/öffnen, somit kann ich´s nicht testen :(
Aber es kann gut sein, dass ich auf Objekte zugreife, die vllt noch nicht erstellt sind, in der Richtung könnte der Fehler liegen. Aber warum klappt es reibungslos, wenn ich währenddessen die Form nicht minimiere/öffne? Welche Objekte sind denn zum OnCreate-Zeitpunkt erzeugt?
mfg

Jojo
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: Do 30.08.07 21:31 
dinge die nicht einfach so in ein on create gehören sind auf jeden fall zugriff auf komponenten. da kommt bei mir zumindestens immer ne fehlermeldung.

lg elundril
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Do 30.08.07 21:36 
Mhhh...Das ist blöd..
Gibts nicht irgendwie sowas wie ein "wenn alles erstellt ist"-Ereignis, das wäre für mich optimal :)
mfg

Jojo
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 30.08.07 21:40 
Moin!

user profile iconJojojoxx hat folgendes geschrieben:
Wenns in OnShow ist sehe ich die Form während dem Prozedurablauf nicht und kann sie daher nicht minimieren/öffnen, somit kann ich´s nicht testen :(

Beim FormCreate ist die Anwendung noch nicht vollständig initialisiert, hier überhaupt mit einer "Benutzbarkeit" zu rechnen, ist schon der Fehler! :mahn:

user profile iconJojojoxx hat folgendes geschrieben:
Aber es kann gut sein, dass ich auf Objekte zugreife, die vllt noch nicht erstellt sind, in der Richtung könnte der Fehler liegen.

:nixweiss:

user profile iconJojojoxx hat folgendes geschrieben:
Aber warum klappt es reibungslos, wenn ich währenddessen die Form nicht minimiere/öffne?

Ohne den Code zu kennen, kann dir das keiner beantworten. :|

user profile iconJojojoxx hat folgendes geschrieben:
Gibts nicht irgendwie sowas wie ein "wenn alles erstellt ist"-Ereignis,

Das ist im FormShow der Fall. :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Do 30.08.07 21:46 
@Narses: Wenn du sagst in FormShow ist alles initialisiert, weshalb ist die Form nicht sichtbar?
mfg

Jojo
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 30.08.07 21:49 
Moin!

user profile iconJojojoxx hat folgendes geschrieben:
@Narses: Wenn du sagst in FormShow ist alles initialisiert, weshalb ist die Form nicht sichtbar?

Zu diesem Zeitpunkt ist alles initialisiert, aber das heißt nicht, dass alle anstehenden Nachrichten abgearbeitet sind... :?

Schick dir im FormShow halt eine selbstdefinierte Nachricht, in deren Handler du dann die Aktionen abarbeitest, dann ist die Form sichtbar. :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Do 30.08.07 21:54 
Da weiß ich leider gar nicht wie ich da rangehen muss :(
mfg

Jojo
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 30.08.07 22:02 
Moin!

Da geht´s zwar um was ganz anderes, aber das Prinzip ist das gleiche -> Nachricht an sich selbst senden. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Fr 31.08.07 08:31 
user profile iconJojojoxx hat folgendes geschrieben:
@Narses: Wenn du sagst in FormShow ist alles initialisiert, weshalb ist die Form nicht sichtbar?


Weil FormShow vor dem anzeigen aufgerufen wird ;)
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: Fr 31.08.07 08:42 
Wobei natürlich bedacht werden sollte, dass man sicherstellt, bestimmte Dinge nur einmal zu machen. Nutzt man zum Beispiel Form.Hide und Form.Show, dann ist so eine Überprüfung zwingend.
In solchen Fällen definiere ich mir immer eine Variable (FirstTime), die ich im FormCreate mit True initialisiere und FormShow abfrage und auf False setze.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 31.08.07 11:49 
Moin!

@user profile iconJojojoxx: wie ist denn der Status, Problem gelöst? Wenn ja, wie? :gruebel:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Fr 31.08.07 13:26 
Das Problem ist noch nicht gelöst, werde mich nachher mal an die Lösung mit der Nachricht setzen und dann nochmal bescheid geben :)
mfg

Jojo
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: So 02.09.07 12:14 
Hi!

Ich habe gerade rasugefunden, dass wenn ich die Komponente CoolTrayIcon (auch auf Form1) aus dem Projekt nehme, besteht das Problem nicht mehr. Zum Zeitpunkt von Form1.Create ist CoolTrayIcon aber bereits erstellt.
Wäre da eine einfachere Lösung möglich als die sache mit der Nachricht?
mfg

Jojo
X-Delphi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: So 02.09.07 12:38 
Titel: Tipp
Ein kleiner Tipp, da eine Sachen nicht in OnCreate funktionieren, kannst du sie auch ins OnActivate der Anwendung einfügen,das hat den selben Effekt.
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: So 02.09.07 12:53 
Hi!

Ich hab den Fehler jetzt gefunden. Ich werde einfach die Form verstecken und in der zeit in der die Prozedur durchläuft eine Form während der Laufzeit erstellen und dafür anzeigen...
Danke für die Hilfe!
mfg

Jojo
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 02.09.07 22:38 
Titel: Re: Tipp
Moin!

user profile iconX-Delphi hat folgendes geschrieben:
nicht in OnCreate funktionieren, kannst du sie auch ins OnActivate der Anwendung einfügen,das hat den selben Effekt.

Nein, das hat es nicht, da OnActivate mehrfach aufgerufen wird (bzw. aufgerufen werden könnte)... :?

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.