hi
-
Hi all, How can i know that the user has pressed ALT+F4 key combination . Thanks in advance.
-
Hi, for example in PreTranslateMessage :
if (msg->message == WM_KEYDOWN)
{
if(msg->wParam == VK_F4 && GetKeyState(VK_LMENU)<0)
{
//--> ALT+F4 pressed
}}
I hope it works ;)
baerten wrote:
if(msg->wParam == VK_F4 && GetKeyState(VK_LMENU)<0)
You want it to work only if the Left Alt is pressed? I would rather suggest
VK_MENU
instead ofVK_LMENU
. Moreover, I doubt if this would ever work!
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->ßRÅhmmÃ<-·´¯`·.
-
Hi all, How can i know that the user has pressed ALT+F4 key combination . Thanks in advance.
Handle
WM_CLOSE
and place the following code in it:if(GetKeyState(VK_MENU)<0 && GetKeyState(VK_F4)<0)
{
AfxMessageBox("Alt and F4 keys are down!");
}[I am assuming that you're working on a dialog based app and using MFC. Do reply if there's something different]
-
Hi, for example in PreTranslateMessage :
if (msg->message == WM_KEYDOWN)
{
if(msg->wParam == VK_F4 && GetKeyState(VK_LMENU)<0)
{
//--> ALT+F4 pressed
}}
I hope it works ;)