Detect if any key is pressed in C# (not A, B, but any)

前端 未结 9 2321
粉色の甜心
粉色の甜心 2020-12-01 08:32

[EDIT 3] I kind of "solved it" by at using the "strange" version. At least for the most important keys. It is suffient for my case, where I want to check

9条回答
  •  星月不相逢
    2020-12-01 09:02

    In the Key Enumeration there is an Enumeration value of Zero(0), which basically tests "No Key Pressed", which is opposite of "Any key pressed". So, something like this might work;

    If !GetKeyState(0)==True then
        Do Something
    End If
    

    Or

    If GetKeyState(0)==False then
        Do Something
    End If
    

提交回复
热议问题