943,844 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1839
  • C++ RSS
Mar 6th, 2009
0

How can i prevent Alt+F4, closing a dialog?

Expand Post »
How can i prevent a dialog closing by Alt+F4 ?
I am using PreTranslateMessage(),,,,what is the Virtual key #define for Alt+F4 or is there any other way?,,,,thank you
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
risa is offline Offline
31 posts
since Jul 2007
Mar 6th, 2009
0

Re: How can i prevent Alt+F4, closing a dialog?

It's a combination of the F4 key code combined with the alt modifiers, you need to check both.

But i'd avoid trying to prevent it if I was you....
Reputation Points: 325
Solved Threads: 118
Master Poster
Freaky_Chris is offline Offline
702 posts
since Apr 2008
Mar 6th, 2009
0

Re: How can i prevent Alt+F4, closing a dialog?

If I remember correctly, Alt+F4 never reaches PreTranslateMessage()
Reputation Points: 395
Solved Threads: 71
Posting Whiz
jencas is offline Offline
362 posts
since Dec 2007
Mar 6th, 2009
0

Re: How can i prevent Alt+F4, closing a dialog?

Here's the list of virtual key codes. jencas makes a good point that I was wondering about myself. Still, give it a try and let us know what happens.
Reputation Points: 163
Solved Threads: 91
Posting Pro in Training
nucleon is offline Offline
476 posts
since Oct 2008
Mar 6th, 2009
0

Re: How can i prevent Alt+F4, closing a dialog?

Click to Expand / Collapse  Quote originally posted by risa ...
How can i prevent a dialog closing by Alt+F4 ?
I am using PreTranslateMessage()
Instead of PreTranslateMessage(), add a handler for WM_SYSCOMMAND and detect SC_CLOSE.
Reputation Points: 1105
Solved Threads: 389
Posting Virtuoso
mitrmkar is offline Offline
1,714 posts
since Nov 2007
Mar 6th, 2009
0

Re: How can i prevent Alt+F4, closing a dialog?

You sure it's not WM_CLOSE?
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Mar 6th, 2009
0

Re: How can i prevent Alt+F4, closing a dialog?

Click to Expand / Collapse  Quote originally posted by Comatose ...
You sure it's not WM_CLOSE?
Yes, SC_CLOSE comes with WM_SYSCOMMAND.
Reputation Points: 1105
Solved Threads: 389
Posting Virtuoso
mitrmkar is offline Offline
1,714 posts
since Nov 2007
Mar 6th, 2009
0

Re: How can i prevent Alt+F4, closing a dialog?

Seems pretty simple to me, add this to the dialog message procedure, and windows shouldn't handle the ALT-F4.
C++ Syntax (Toggle Plain Text)
  1. case WM_SYSKEYDOWN: break;
Last edited by William Hemsworth; Mar 6th, 2009 at 12:22 pm.
Reputation Points: 1429
Solved Threads: 129
Posting Virtuoso
William Hemsworth is offline Offline
1,542 posts
since Mar 2008
Mar 6th, 2009
0

Re: How can i prevent Alt+F4, closing a dialog?

Seems pretty simple to me, add this to the dialog message procedure, and windows shouldn't handle the ALT-F4.
C++ Syntax (Toggle Plain Text)
  1. case WM_SYSKEYDOWN: break;
Hmm .. that renders the system menu completely ineffective, which is probably not what the OP wants.
Reputation Points: 1105
Solved Threads: 389
Posting Virtuoso
mitrmkar is offline Offline
1,714 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Scanf doesn't work? HELP!! Reading in wrong things... Homework Due tonight!
Next Thread in C++ Forum Timeline: Help with pointer program





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC