Title: How to prevent Alt+F4
public
procedure AppMessage(var Msg: TMSG; var HAndled: Boolean);
end;
{...}
implementation
{...}
procedure TForm1.FormCreate(Sender: TObject);
begin
// set your applications message handler to your new one
Application.OnMessage := AppMessage;
end;
procedure TForm1.AppMessage(var Msg: TMSG; var Handled: Boolean);
begin
// let your application handle all messages initially
Handled := False;
case Msg.Message of
WM_SYSKEYDOWN:
if Msg.wParam = VK_F4 then
Handled := True; // don't allow ALT-F4
end;
end;
Or Write in the OnCloseQuery handler CanClose := False