Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Alt+F4

Posted on 2003-03-01
6
Medium Priority
?
597 Views
Last Modified: 2010-04-04
How can I disable a form's Alt+f4 event without modifying the on close querry event(canclose:=false)
0
Comment
Question by:rayek007
6 Comments
 
LVL 3

Accepted Solution

by:
ILE earned 100 total points
ID: 8049649
100% working solution

u must first do


procedure TForm1.FormCreate(Sender: TObject);
begin
form1.keypreview:=true;
end;


procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 if (shift=[ssalt])  and (key=vk_f4) then key:=0;
end;



easy arent?
0
 
LVL 3

Assisted Solution

by:BTecho
BTecho earned 100 total points
ID: 8054547
Hello

If you happen to use a TMainMenu or TPopupMenu you easily prevent alt+f4 like so.

Just add a new item to the menu set its shortcut to Alt+F4 set the Visible property to false. On the Onclick event of the item just put some commented code.

Thats it!
0
 
LVL 3

Expert Comment

by:Slavak
ID: 8055676
when you press Alt+F4, windows sends WM_CLOSE message to currently active window.

If you want to change the default behaviuor just ovveride the message:


Type
  TForm1 = class(TForm)
  ...
  private
    procedure WMClose(var Msg : TMessage); message WM_CLOSE;
  ...
  end;


procedure TForm1.WMClose(var Msg : TMessage);
begin
// for default behaviour call to inherited
end;




0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Expert Comment

by:CleanupPing
ID: 9316989
rayek007:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 9999597
Hi!
No comment has been added lately and this question is therefore classified abandoned.

If asker wishes to close the question, then refer to
http://www.experts-exchange.com/help/closing.jsp

Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:

Split between ILE and BTecho

Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

...Snehanshu
EE Cleanup Volunteer

P.S.
  Only 50 points so can't give points to Slavak also.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 10029527
Forced accept

Computer101
E-E Admin
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

578 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