Autor Beitrag
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 21.11.04 10:18 
Hallo!

Hier meine 2. Frage zum Herunterfahren/Abmelden/Neustarten mit Windows und einem Delphi-Programm.

Wie kann ich einen durch WM_QUERYENDSESSION unterbrochenen Shutdown/etc. wieder einleiten?

Danke!

Alstar
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: So 21.11.04 14:22 
1. In dem du erst deine Dinge abarbeitest und sofort "Es darf runtergefahren werden" zurückgibst.
2. Genauso, wie du Windows auch normal herunterfahren würdest.

_________________
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.
Alstar Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 21.11.04 18:19 
Wie soll ich das machen?

Wenn ich die Dinge in der Procedure vom WM_QUERYENDSESSION-Event abarbeite, kommt nach kurzer Zeit das Fenster "Die Anwendung reagiert nicht".

Oder was meinst du mit

BenBE hat folgendes geschrieben:

In dem du erst deine Dinge abarbeitest und sofort "Es darf runtergefahren werden" zurückgibst.


Zu 2.:

Ich weiß ja eben nicht, ob der Benutzer sich abmelden/neustarten oder herunterfahren wollte ...

Alstar
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: So 21.11.04 18:38 
Welche Routinen dauern denn zu lange?

_________________
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.
Alstar Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 21.11.04 18:56 
Das ganze Programm is ja noch in Planung, aber es wird eine Datei-Routine (TFileStream / TCompressionStream) werden, die etwas länger brauchen könnte

Alstar
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: So 21.11.04 23:31 
Eine Möglichkeit wäre, dass du die Routine in einen Thread auslagerst und diesen Thread in WM_QUERYENDSESSION startest. Danach gibst du schon "bin fertig" zurück, behandelst aber mit Application.ProcessMessages alle ankommenden Messages. Eine Prüfung auf Application.Terminated ignorieren, weil sonst der Thread abgebrochen werden würde.

Ansonsten kannst du dich im Ernstfall immer noch hier im Board melden.

_________________
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.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 21.11.04 23:57 
Breche das Runterfahren ab und wenn du fertig bist, dann fährst du den Rechner ben von deinem Programm aus runter.
Alstar Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Mo 22.11.04 16:36 
Luckie hat folgendes geschrieben:

Breche das Runterfahren ab und wenn du fertig bist, dann fährst du den Rechner ben von deinem Programm aus runter.


Ich glaube ich habe ein Kommunikationsproblem :evil:

DAS IST DOCH MEIN PROBLEM! Ich weiß nicht, was der Benutzer wollte: Ob er den PC herunterfahren, neustarten oder sich nur abmleden wollte ... Mit meinem Programm würde nun der PC immer runtergefahren ...

Kapiert ihr mein Problem?? :cry:

Alstar
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 22.11.04 16:55 
Dann prüf den lParam von WM_QUERYENDSESSION.
Zitat:

lParam
If this parameter includes ENDSESSION_LOGOFF, the user is logging off. (Note that this parameter is a bit mask. To test for this value, use a bit-wise operation; do not test for equality.)
If this parameter is zero, the system is shutting down.
Alstar Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Mo 22.11.04 16:57 
Aber die Funktion sagt mir nicht, ob das System neugestartet werden soll ...

Alstar