Delphi-Quellcode:
type
TForm1 =
class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
procedure WndProc(
var msg: TMessage);
override;
end;
const
MyMessage = WM_USER+1974;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WndProc(
var msg: TMessage);
begin
inherited;
case msg.Msg
of
MyMessage: ShowMessage('
Huhu');
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
SendMessage(
Handle, MyMessage, 0, 0);
end;
Und das machst du jetzt mit WM_QUERYENDSESSION.