Autor Beitrag
Christian V.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 311

Win Xp Prof
Turbo Delphi 2005
BeitragVerfasst: So 06.03.05 10:42 
Hallo, ich habe ein Problem: Mein Programm wird beim Shutdown nicht beendet, es kommt auch keine Fehlermeldung, aber Windows fährt nicht herunter. liegt es daran dass ich eine CloseQuerry function drinhabee und CanClose immer auf false setze?
Oder liegt es daran dass ich meine Anwendung versteckt habe?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if f=true then begin
   canclose:=true;
end
else begin
   canclose:=false;
   form1.Button2Click(Sender);
end;
end;

das f ist, wenn ich die Anwendung per Hotkey beende, damit er weiss, wann ichs zumachen darf.
Project:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
program NVIDIA;

uses
  Forms,
  main in 'main.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.ShowMainForm:=false;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

//edit: oder gibt es noch ne andere Möglichkeit, als den ShutdownBefehl abzufangen?

_________________
Hardware runs the world, software controls the hardware, code generates software - Have You already coded today?
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 06.03.05 15:07 
invulnerabilis hat folgendes geschrieben:
liegt es daran dass ich eine CloseQuerry function drinhabee und CanClose immer auf false setze?
Oder liegt es daran dass ich meine Anwendung versteckt habe?

Wohl eher ersteres. Windows versendet vor dem Runterfahren die Nachricht Suche im MSDN WM_QUERYENDSESSION setzt dort f auf True und es sollte gehen.
Christian V. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 311

Win Xp Prof
Turbo Delphi 2005
BeitragVerfasst: Mo 07.03.05 16:54 
Ääh wie fang ich denn die Nachricht ab? :roll:

_________________
Hardware runs the world, software controls the hardware, code generates software - Have You already coded today?
Lesco
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 42



BeitragVerfasst: Fr 18.03.05 16:29 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure CloseOnShutdown; message WM_QUERYENDSESSION;
.
.


implementation

procedure TForm1.CloseOnShutown;
begin
     Self.CLose;
end;