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

Started by
7 comments, last by Alessio1989 10 years, 5 months ago

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.

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/
Advertisement

Are you handling WM_SYSKEYDOWN messages?

http://msdn.microsoft.com/en-us/library/windows/desktop/ms646286%28v=vs.85%29.aspx

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

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

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/

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...

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/

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.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

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

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/

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.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

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 unsure.png

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/

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

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/

This topic is closed to new replies.

Advertisement