Solved

Disabling Alt-F4 Close Behavior

Posted on 1998-11-17
3
508 Views
Last Modified: 2013-11-20
I'm writing an application which will be displayed in a kiosk. I've successfully disabled almost everything that could potentially close the app, except for the ALT-F4 Close combination.

Can someone tell me how to disable ALT-F4?

Things I've tried:
1)
// Turn System Keys (like windows, alt-tab, etc) off
UINT nOldVal;
SystemParametersInfo (SPI_SCREENSAVERRUNNING, 1, &nOldVal, 0);

Very handy for turning off Windows Menu, CTRL-ALT-DEL, etc, but not ALT-F4!

2) Create a key accelerator for ALT-F4 and map it to an empty method. This didn't work.

3) Try catching WM_SYSKEYDOWN message in PreTranslateMessage. It seemed that the app closes before that method is called.

Thanks for your help,
bre++
0
Comment
Question by:circuit
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
thresher_shark earned 50 total points
ID: 1324860
Answer coming...
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324861
What you want to do is override the OnClose CWnd member function.  From what it looks like you've done already, you can probably figure out how to do this, but in any case:

1) Open your app's header.
2) Add:
   void OnClose ();

3) Open the CPP file
4) Add:
   void CMyApp::OnClose ()
   { }
5) Recompile

All done!

If you have any further questions regarding this problem, please feel free to ask.  Thanks!
0
 

Author Comment

by:circuit
ID: 1324862
You gotta put it on the window class, not the app. Works great though! Thanks.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

758 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

22 Experts available now in Live!

Get 1:1 Help Now