Solved

Disabling Alt-F4 Close Behavior

Posted on 1998-11-17
3
514 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
[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
  • 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

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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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 video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

696 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