AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Abfrage ob Pogramm geschlossen werden soll.

Ein Thema von Sudrow · begonnen am 23. Okt 2008 · letzter Beitrag vom 21. Feb 2010
Antwort Antwort
Seite 2 von 3     12 3      
Sven M.

Registriert seit: 21. Okt 2006
Ort: Halle/Saale
106 Beiträge
 
Delphi 5 Enterprise
 
#11

Re: Abfrage ob Pogramm geschlossen werden soll.

  Alt 23. Okt 2008, 15:29
Zitat von Progman:
Versuchs mal im CloseQuery:

Delphi-Quellcode:
if MessageDlg('Programm schließen?', mtConfirmation, [mbyes, mbno], 0) = mrYes then
 CanClose := True else CanClose := False;

Habe auch im Moment ein paar Problemchen mit dem ordnungsgemäßen Schließen des Programms. Das Problem: Wenn ich es genau so mache wie oben, ist die Anwendung zwar weg, steht aber im Taskmanager noch drin. Hat jemand 'ne Ahnung, woran das liegt?


Besten Dank im Voraus,
Sven M.
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.540 Beiträge
 
Delphi 11 Alexandria
 
#12

Re: Abfrage ob Pogramm geschlossen werden soll.

  Alt 23. Okt 2008, 15:31
Tritt das Phänomen auch dann auf, wenn Du oben zitierten Code auskommentierst?
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
Sven M.

Registriert seit: 21. Okt 2006
Ort: Halle/Saale
106 Beiträge
 
Delphi 5 Enterprise
 
#13

Re: Abfrage ob Pogramm geschlossen werden soll.

  Alt 23. Okt 2008, 15:41
Ja, auch dann!

Kann es eventuell daran liegen, dass das Fenster, aus dem ich das Programm beenden möchte, nicht das im Projektmanager eingestellte Hauptfenster ist?


Dann hätte ich das nächste Problem: Wie kann ich abfragen, von wo aus einer Procedure aufgerufen wird. Denn im OnCloseQuery des Hauptformulars müsste ich ja dann den Fall abfangen, dass ich das Programm beenden möchte oder nur das Fenster schließen will...Verwirrend...
  Mit Zitat antworten Zitat
Benutzerbild von SirThornberry
SirThornberry
(Moderator)

Registriert seit: 23. Sep 2003
Ort: Bockwen
12.235 Beiträge
 
Delphi 2006 Professional
 
#14

Re: Abfrage ob Pogramm geschlossen werden soll.

  Alt 23. Okt 2008, 15:42
@Seven: Das kommt in aller Regel vor wenn man mit Threads hantiert und da noch einer läuft oder man mit Application.Processmessages Nachrichten abarbeitet während man noch in einer Schleife hängt.
Jens
Mit Source ist es wie mit Kunst - Hauptsache der Künstler versteht's
  Mit Zitat antworten Zitat
Sven M.

Registriert seit: 21. Okt 2006
Ort: Halle/Saale
106 Beiträge
 
Delphi 5 Enterprise
 
#15

Re: Abfrage ob Pogramm geschlossen werden soll.

  Alt 24. Okt 2008, 07:52
Hab's gefunden...=)

Lag tatsächlich daran, dass ich das Programm von einem anderen als dem Hauptfesnter (in den Projektoptionen) aus schließen wollte.
Hab's jetzt so gelöst, dass das eigentliche Hauptfenster (aus User-Sicht) auch das Hauptfenster in den Projektoptionen ist und das Fenster, das beim Start angezeigt werden soll (deswegen war's das Hauptfenster) über einen Timer geöffnet wird...
  Mit Zitat antworten Zitat
Micha88
(Gast)

n/a Beiträge
 
#16

Re: Abfrage ob Pogramm geschlossen werden soll.

  Alt 24. Okt 2008, 08:49
Also ich persönlich mag den MessageDlg nicht so


Ich mache das immer so:

Delphi-Quellcode:
procedure THaupt.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 if (Application.MessageBox('Sind Sie sicher, dass Sie diese Anwendung schließen möchten?', 'Information', MB_IconInformation + MB_YesNo) = ID_Yes) then
  begin
   // ggf. alles freigeben, Bitmaps, SL's usw
   Self.Close; // ENDE!
  end;
end;
  Mit Zitat antworten Zitat
Sven M.

Registriert seit: 21. Okt 2006
Ort: Halle/Saale
106 Beiträge
 
Delphi 5 Enterprise
 
#17

Re: Abfrage ob Pogramm geschlossen werden soll.

  Alt 24. Okt 2008, 09:10
Hat das bestimmte Gründe?
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.540 Beiträge
 
Delphi 11 Alexandria
 
#18

Re: Abfrage ob Pogramm geschlossen werden soll.

  Alt 24. Okt 2008, 09:22
Eine MessageBox wird von Windows gezeichnet, ein MessageDlg von Delphi.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
Cicaro

Registriert seit: 9. Feb 2005
285 Beiträge
 
Delphi 7 Personal
 
#19

Re: Abfrage ob Pogramm geschlossen werden soll.

  Alt 21. Feb 2010, 15:20
Geht diese Abfrage auch modal ?

Edit: Schon gut, ist schon standardmäßig modal. Bei mir wird die Abfrage durch einen Timer mehrmals aufgerufen. Muss nur den Timer ausschaten, damit die Abfrage nicht nochmal erfolgt.
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.540 Beiträge
 
Delphi 11 Alexandria
 
#20

Re: Abfrage ob Pogramm geschlossen werden soll.

  Alt 21. Feb 2010, 15:28
Die Windows.MessageBox zumindest geht auch modal MSDN-Library durchsuchenMessageBox.
Zitat:
To indicate the modality of the dialog box, specify one of the following values.

MB_APPLMODAL
The user must respond to the message box before continuing work in the window identified by the hWnd parameter. However, the user can move to the windows of other threads and work in those windows.

Depending on the hierarchy of windows in the application, the user may be able to move to other windows within the thread. All child windows of the parent of the message box are automatically disabled, but pop-up windows are not.

MB_APPLMODAL is the default if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
MB_SYSTEMMODAL
Same as MB_APPLMODAL except that the message box has the WS_EX_TOPMOST style. Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate attention (for example, running out of memory). This flag has no effect on the user's ability to interact with windows other than those associated with hWnd.
MB_TASKMODAL
Same as MB_APPLMODAL except that all the top-level windows belonging to the current thread are disabled if the hWnd parameter is NULL. Use this flag when the calling application or library does not have a window handle available but still needs to prevent input to other windows in the calling thread without suspending other threads.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 3     12 3      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:27 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz