Why do I get two messages on `AltGr` being pressed

2019-02-26 17:05发布

Why do I get two messages on AltGr being pressed?

I have the following hook:

LRESULT CALLBACK MyClass::KeyboardShotcutsHook(int code, WPARAM wParam, LPARAM lParam)

When in polish language I press AltGR+Key (right Alt) it produces 2 messages:

  1. Ctrl+Key
  2. Alt+Ctrl+Key

Why? and how to avoid Ctrl+Key?

1条回答
倾城 Initia
2楼-- · 2019-02-26 17:28

Because AltGr and Alt+Ctrl are equivalent (in Windows). Two key stroke sequences mean the same thing, and Alt+Ctrl won (probably because there is no AltGr on the US keyboard layout - that's my guess).

If you want to check for AltGr, check if Ctrl is pressed whenever Alt shows up in your hook.

查看更多
登录 后发表回答