Solved

Overrule Alt-F4 event

Posted on 1998-08-26
1
194 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now