Solved

Disabling Alt-F4 Close Behavior

Posted on 1998-11-17
3
510 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
method notes when mouse over in eclipse 5 86
fizzArray2 challenge 1 79
Dell Alienware Graphics Amplifier Driver for non-Alienware systems 18 249
mapAB Challlenge 35 143
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

786 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