Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

c++ - RAWINPUT.Keyboard: How to detect arrow keys when NUMLOCK=ON?

When NUMLOCK=ON then

Key ARROW_UP pressed:

data.keyboard.MakeCode = 42;
data.keyboard.VKey = 255;
data.keyboard.Flags = 2;
data.keyboard.Message = 256 (WM_KEYDOWN)

Key ARROW_DOWN pressed:

data.keyboard.MakeCode = 42;
data.keyboard.VKey = 255;
data.keyboard.Flags = 2;
data.keyboard.Message = 256 (WM_KEYDOWN)

Key ARROW_LEFT pressed:

data.keyboard.MakeCode = 42;
data.keyboard.VKey = 255;
data.keyboard.Flags = 2;
data.keyboard.Message = 256 (WM_KEYDOWN)

Key ARROW_RIGHT pressed:

data.keyboard.MakeCode = 42;
data.keyboard.VKey = 255;
data.keyboard.Flags = 2;
data.keyboard.Message = 256 (WM_KEYDOWN)

How to detect arrow keys when NUMLOCK=ON?

  • When NUMLOCK=OFF then all working well;
  • DirectInput (from DirectX 8.0) works well in both cases;
question from:https://stackoverflow.com/questions/65848114/rawinput-keyboard-how-to-detect-arrow-keys-when-numlock-on

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Add flag: RIDEV_NOLEGACY and filter messages where VKey == 255


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...