Solved

Overrule Alt-F4 event

Posted on 1998-08-26
1
200 Views
Last Modified: 2010-04-04
I want to prevent closing my delphi application by ALT-F4. I think that I have to write an Windowsmessage event handler, but how ?
Can i use the WM_CLOSE message to detect this ?
0
Comment
Question by:rene041697
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
erajoj earned 100 total points
ID: 1337801
Hi,
Do the following simple steps:

1. Set Form's proterty KeyPreview := True;

2. Implement this simple event handler:

   procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
     Shift: TShiftState);
   begin
     if ( ( Key = VK_F4 ) and ( ssAlt in Shift ) )
     then Key := 0;
   end;

Note: this doesn't prevent the window from closing with the system menu or the close button.

/// John
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question