AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Anwendung beenden bei Windows Shutdown (WM_QueryEndSession)

Anwendung beenden bei Windows Shutdown (WM_QueryEndSession)

Ein Thema von AJ_Oldendorf · begonnen am 3. Apr 2014 · letzter Beitrag vom 4. Apr 2014
Antwort Antwort
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.374 Beiträge
 
Delphi 12 Athens
 
#1

AW: Anwendung beenden bei Windows Shutdown (WM_QueryEndSession)

  Alt 4. Apr 2014, 08:24
Das trifft hier ja nicht zu, denn das Speichern soll ja beim Beenden passieren.
Wieso denn nicht?

Damit sagt man, daß man noch etwas Zeit braucht und informiert Windows und den Nutzer davon.
Und nun lest mal die Beschreibung der zugehörigen Destroy-Funktion.


Und nein, der Dialog, wo dr Benutzer gefragt wird, ist nicht immer da,
denn man kann Windows beim Runterfahren sagen, daß es nicht auf "hängende" Anwendungen warten soll.
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Benutzerbild von Sir Rufo
Sir Rufo

Registriert seit: 5. Jan 2005
Ort: Stadthagen
9.454 Beiträge
 
Delphi 10 Seattle Enterprise
 
#2

AW: Anwendung beenden bei Windows Shutdown (WM_QueryEndSession)

  Alt 4. Apr 2014, 08:49
Es bleibt die Frage zu klären, wann eine Anwendung als hängend gilt. Wenn die Anwendung korrekt auf die Nachrichten innerhalb der vorgegebenen Zeitfenster die Rückmeldungen gibt, dann hängt diese eben nicht.
  • Application shutdown procedure in a non-critical shutdown
    MessageVisible top-level window or reason string specifiedNo visible top-level window and no reason string specified
    WM_QUERYENDSESSIONApplication can take as much time as needed to respond to WM_QUERYENDSESSION. Windows displays new UI after 5 seconds.Application has 5 seconds to respond to WM_QUERYENDSESSION, and then Windows terminates the application if the application is unresponsive.
    WM_QUERYENDSESSIONWindows displays new UI if the application responds FALSE to WM_QUERYENDSESSION.Windows sends WM_ENDSESSION message to the application if the application responds FALSE to WM_QUERYENDSESSION.
    WM_ENDSESSIONApplication can take as much time as needed to respond to WM_ENDSESSION. Windows displays new UI after 5 seconds.Application has 5 seconds to respond to WM_ENDSESSION, and then Windows terminates the application if the application is unresponsive.
  • Application shutdown procedure in a critical shutdown
    MessageVisible top-level window or reason string specifiedNo visible top-level window and no reason string specified
    WM_QUERYENDSESSIONApplication has 1 second to respond to WM_QUERYENDSESSION, and then Windows terminates the application if the application is unresponsive.Application has 1 second to respond to WM_QUERYENDSESSION, and then Windows terminates the application if the application is unresponsive.
    WM_QUERYENDSESSIONIf the application responds FALSE to WM_QUERYENDSESSION, Windows sends WM_ENDSESSION message to the application.If the application responds FALSE to WM_QUERYENDSESSION, Windows sends WM_ENDSESSION message to the application.
    WM_ENDSESSIONApplication has 30 seconds to respond to WM_ENDSESSION, and then Windows terminates the application if the application is unresponsive.Application has 5 seconds to respond to WM_ENDSESSION, and then Windows terminates the application if the application is unresponsive.
Der Benutzer kann das Herunterfahren aber immer noch provozieren (egal welche Meldungen man an das System abgegeben hat), denn der soll entscheiden.

MSDN-Library durchsuchenShutdownBlockReasonCreate
Zitat:
Because users are typically in a hurry when shutting down the system, they may spend only a few seconds looking at the shutdown reasons that are displayed by the system. Therefore, it is important that your reason strings are short and clear. For example "A CD burn is in progress." is better than "This application is blocking system shutdown because a CD burn is in progress. Do not shut down."
Kaum macht man's richtig - schon funktioniert's
Zertifikat: Sir Rufo (Fingerprint: ‎ea 0a 4c 14 0d b6 3a a4 c1 c5 b9 dc 90 9d f0 e9 de 13 da 60)
  Mit Zitat antworten Zitat
Benutzerbild von Sir Rufo
Sir Rufo

Registriert seit: 5. Jan 2005
Ort: Stadthagen
9.454 Beiträge
 
Delphi 10 Seattle Enterprise
 
#3

AW: Anwendung beenden bei Windows Shutdown (WM_QueryEndSession)

  Alt 4. Apr 2014, 09:19
Das trifft hier ja nicht zu, denn das Speichern soll ja beim Beenden passieren.
Wieso denn nicht?

Damit sagt man, daß man noch etwas Zeit braucht und informiert Windows und den Nutzer davon.
Und nun lest mal die Beschreibung der zugehörigen Destroy-Funktion.
Nach meinem Verständnis der Doku muss MSDN-Library durchsuchenShutdownBlockReasonCreate schon vor MSDN-Library durchsuchenWM_QUERYENDSESSION vorhanden sein. Das könnte man durchaus direkt beim Start der Anwendung absetzen (bzw. dann, wenn die ersten Daten erzeugt/gesammelt werden) und wieder entfernen, wenn die Speicherung selbiger erfolgt ist.

Eine Garantie (wird immer komplett durchgeführt) ist das aber immer noch nicht.
Kaum macht man's richtig - schon funktioniert's
Zertifikat: Sir Rufo (Fingerprint: ‎ea 0a 4c 14 0d b6 3a a4 c1 c5 b9 dc 90 9d f0 e9 de 13 da 60)
  Mit Zitat antworten Zitat
Antwort Antwort

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

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 08:05 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz