Keyboard modifiers during application startup

后端 未结 3 348
梦毁少年i
梦毁少年i 2021-01-22 17:36

I wanted to capture whether a modifier key was being pressed during application startup (to determine fullscreen or windowed).

In the main window constructor I tried che

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-22 18:20

    I bet Keyboard.Modifiers is using GetKeyState under the covers, which probably doesn't work until your message loop has dispatched its first message. GetAsyncKeyState would work for you (via P/Invoke I guess, unless there's a .net way of calling it that I don't know about).

提交回复
热议问题