Question:
I dont want my application killed by Alt+F4.
Possible?

Answer:
Sure, here the code:



public

procedure AppMessage(var Msg: TMSG; var HAndled: Boolean);
end;
{...}
implementation
{...}

procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage := AppMessage;
end;

procedure TForm1.AppMessage(var Msg: TMSG; var Handled: Boolean);
begin
Handled := False;
case Msg.Message of
WM_SYSKEYDOWN:
if Msg.wParam = VK_F4 then
Handled := True; // don't allow ALT-F4
end;
end;



7 Responses so far.

  1. Putra Sahara says:
    This comment has been removed by the author.
  2. Okay, Nice

Post a Comment

Thank you for your comment.

Any request and idea are welcome.

CLICK TO REGISTER