Skip to main content
GameDev.net gamedev.net
🔒 Locked

[win32] Disable ALT+F4

Started by Ruudje Apr 24, 2005 at 2:51 AM 3 replies 11.2k views
Original Post
Ruudje
Ruudje
Hi all, I am looking for a way to disable or catch the alt+f4 event from my program. Unfortunately Google must think "hey, it's sunday morning, go away" , since it isnt producing any useful results. Can someone tell me how to do it? I guess in the window procedure, under the case WM_KEYDOWN: I have to set the message to 0 or something, but can;t get it working.. Tnx in advance.
Endurion
Endurion
Only Alt-F4 or generally any close command issued from the user?

To do latter, listen to WM_CLOSE and don't pass it on to the base window proc.
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>
Ruudje
Ruudje
No I'm interested in the alt+f4 key combo. It's an opengl app and doenst show the normal window borders (fullscreen). The program features it's own commands for shutting down and cleaning up, but i don't want it to end using alt+f4
Endurion
Endurion
Look into WM_SYSKEYDOWN. If wParam == VKEY_F4 then the user pressed Alt-F4. If you swallow that message (not pass it on) that should work.
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>
Ruudje
Ruudje
Works. Tnx. (was VK_F4 btw)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.