Solved

Disabling Alt-F4 Close Behavior

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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…
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.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

932 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

13 Experts available now in Live!

Get 1:1 Help Now