Solved

Overrule Alt-F4 event

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 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