Autor Beitrag
Roadrunner25
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 89

Win XP
D7
BeitragVerfasst: Mi 22.08.07 09:07 
Hallo Zusammen!

Ich habe leider ein kleines großes Problem!
Habe ein Programm beschrieben, dass aus mehreren Form-Fenstern besteht. Ein Fenster ist hierbei das Hauptformular.

Das Programm soll auf durch ein Button-Click- Ereignis beendet werden. Das funktioniert soweit auch.....jetzt habe ich aber festgestellt, das es vorkommt, dass in der Taskleiste die EXE-Datei immer noch ausgeführt wird.....

Weis jemand rat, wie ich voll und ganz das Programm beende?

Edit: Habe gerade herausgefunden, dass der Fehler nur auftaucht, wenn man die Fenster über das "X" rechts oben beendet!?!?!? Komischer Fehler!

Gruß Roadrunner
Migi
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Mi 22.08.07 09:14 
Wie beendest du das Programm?
Roadrunner25 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 89

Win XP
D7
BeitragVerfasst: Mi 22.08.07 09:20 
Der Button für das Ende des Programms befindet sich auf Form1.
Hauptformular ist allerdings Form2!

Im OnClick Ereignis steht:

ausblenden Delphi-Quelltext
1:
Form2.Close					
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: Mi 22.08.07 09:23 
Im Zweifel ruf einfach
ausblenden Delphi-Quelltext
1:
Application.Exit;					

auf.
Roadrunner25 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 89

Win XP
D7
BeitragVerfasst: Mi 22.08.07 09:27 
Da sagt er bei mir " Undefinierter Bezeichner 'Exit'"....
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Mi 22.08.07 09:30 
Nimm doch das:
ausblenden Delphi-Quelltext
1:
halt;					


Oder:
ausblenden Delphi-Quelltext
1:
Application.MainForm.Close;					
Roadrunner25 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 89

Win XP
D7
BeitragVerfasst: Mi 22.08.07 09:35 
Hmm....so richtig funktioniert das noch nicht! Das Problem ist ja, dass das Programm nicht richtig beim Anklicken des "X" des Windowsfenster schließt....kann man nicht einfach das "X" sperren??? oder anders daruf zugreifen!?
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Mi 22.08.07 09:44 
Application.Exit existiert nicht, der Befehl heißt Application.Terminate! Und nimmt bloß nicht halt (übrigens halt(0), der Errorlevel muss angegeben werden).
Application.Terminate ist genau der Befehl, den du suchst.

Das ein Programm beim Schließen von einem Formular, das nicht Hauptformular ist, nicht beendet wird, ist übrigens ein vollkommen normales Verhalten.

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
Roadrunner25 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 89

Win XP
D7
BeitragVerfasst: Mi 22.08.07 09:47 
Der Befehl funktioniert auch! Nur er wird ja nicht aktiviert, wenn ich das X oben rechts im Windowsfenster betätige...oder greift dieser dann auf den Befehl zu?
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Mi 22.08.07 10:12 
user profile iconRoadrunner25 hat folgendes geschrieben:
Der Befehl funktioniert auch! Nur er wird ja nicht aktiviert, wenn ich das X oben rechts im Windowsfenster betätige...oder greift dieser dann auf den Befehl zu?

Trag ihn doch einfach unter OnCloseQuery ein.

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
Roadrunner25 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 89

Win XP
D7
BeitragVerfasst: Mi 22.08.07 10:29 
Danke Timosch!

Funktioniert! Habe den Befehl noch nie verwendet, deshalb kannte ich ihn nicht! Jetzt bin ich wieder etwas schlauer!;)
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Mi 22.08.07 10:32 
user profile iconRoadrunner25 hat folgendes geschrieben:
Danke Timosch!

Funktioniert! Habe den Befehl noch nie verwendet, deshalb kannte ich ihn nicht! Jetzt bin ich wieder etwas schlauer!;)


Bitte schön. Jetzt hab ich in 6,5 Wochen Sommerferien wenigstens eine gute Tat vollbracht :mrgreen:

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
Tilman
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1405
Erhaltene Danke: 51

Win 7, Android
Turbo Delphi, Eclipse
BeitragVerfasst: Mi 22.08.07 10:49 
Als Ergänzung noch die Antwort auf deine Frage: im Objektinspektor kannst du unter "BorderIcons" das "Systemmenu" deaktivieren; dann verschwindet der X-Button. Aber in diesem Fall ist natürlich OnCloseQuerry dein Freund. Noch eine Ergänzung: in OnCloseQuerry kannst du mit canclose=false auch festlegen dass ein Fenster bzw. die Applikation nicht beendet werden kann (z.B. um nachzufragen ob gespeicher werden soll)

_________________
Bringe einen Menschen zum grübeln, dann kannst du heimlich seinen Reis essen.
(Koreanisches Sprichwort)