(CodeLib-Manager)
Registriert seit: 10. Jun 2002
4.648 Beiträge
Delphi XE Professional
|
Re: Art des Shutdown herausfinden
28. Jul 2005, 00:17
aus einer google paq:
Delphi-Quellcode:
type
TForm1 = class(TForm)
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
procedure WMQueryEndSession(var Msg: TWMQueryEndSession); message
WM_QUERYENDSESSION;
procedure WMEndSession(var Msg: TWMEndSession); message
WM_ENDSESSION;
public
end;
procedure TForm1.WMEndSession(var Msg: TWMEndSession);
var
S1, S2: String;
begin
case Msg.Unused of
Integer(ENDSESSION_LOGOFF): S1 := 'Benutzer abmelden';
else S1 := 'Windows beenden';
end;
if Msg.EndSession
then S2 := ' wird jetzt durchgeführt'
else S2 := ' abgebrochen';
ShowMessage(S1 + S2);
inherited;
end;
procedure TForm1.WMQueryEndSession(var Msg: TWMQueryEndSession);
var
S: String;
begin
case Msg.Unused of
Integer(ENDSESSION_LOGOFF): S := 'Benutzer abmelden';
else S := 'Windows beenden';
end;
if MessageDlg(S+' okay?', mtConfirmation, [mbYes, mbNo], 0) = mrYes
then Msg.Result := 1
else Msg.Result := 0;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose:
Boolean);
begin
CanClose := MessageDlg('Anwendung beenden okay?',
mtConfirmation, [mbYes, mbNo], 0) = mrYes;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ShowMessage('Anwendung wird jetzt beendet');
end;
Thomas
|
|
Zitat
|