Followers 0

# disable default system 'left alt' key behaviour in a window

## 8 posts in this topic

Hi,

is there a way to disable the "system behaviour" of the 'left alt' key in a window?

Please note that I don't wanna completely disable it, I only need to disable the "special" system behaviour.

0

##### Share on other sites

thank you, it worked. Now I have to disable the alt-space combo for the app-menu but a simple style-change should works.

Ok, this works for a single click/action of the left-alt key:

case WM_SYSKEYDOWN:
if( wParam == VK_MENU )// left-alt key
{
foo();
}
break;


but if the left-alt key is not released, the key still behave as a system command...

0

##### Share on other sites

You should get another WM_SYSKYDOWN message with bit 29 set to 1 in the lParam in that case?

Bits Meaning 29 The context code. The value is 1 if the ALT key is down while the key is pressed; it is 0 if the WM_SYSKEYDOWN message is posted to the active window because no window has the keyboard focus.

0

##### Share on other sites

You should get another WM_SYSKYDOWN message with bit 29 set to 1 in the lParam in that case?

Bits Meaning 29 The context code. The value is 1 if the ALT key is down while the key is pressed; it is 0 if the WM_SYSKEYDOWN message is posted to the active window because no window has the keyboard focus.



default:
lParam |= 1 << 29;
return( DefWindowProc( window, message, wParam, lParam ) );


in this way I can disable the application system menu, but the left-alt key still behaves as a "system key" (ie: if left-alt key is still pressed, message case like WM_KEYDOWN are not processed and the windows "ding" sounds .-. )

What I want is disable this "special system behaviour"  to the left alt key, but maybe that's not a good idea... :s

Edited by Alessio1989
0

##### Share on other sites

I don't get why you are modifying lParam?

If you don't want the default behaviour, return the appropriate value from your window procedure to say you handled it, and DO NOT call DefWindowProc if you handle the message yourself.

0

##### Share on other sites

sorry, it's late  here ( 03:43 AM.).. maybe I should go to sleep...

so this is what I have:



case WM_SYSKEYDOWN:
if( wParam == VK_MENU || wParam == VK_F10 )// left-alt and f10 keys
{
foo();
}
break;


this works fine with F10: the application process other case-action (like WM_KEYs messages) even if the F10 key is not released. That's not happens if the left ALT key is not released: I got the annoying windows "ding" sound and other things associated to other message cases don't happen.

Thank you for your patience

Edited by Alessio1989
0

##### Share on other sites

never mind, I will redefine the alt-key with a custom LowLevelKeyboardProc, Windows could be such a bitch...

0

## Create an account

Register a new account