I’m trying to capture shift + tab in c# using the following cpp syntax:
if (GetAsyncKeyState(VK_SHIFT) & 0x8000)
{
// The key is currently down
}
Can anyone point me to the c# equivalent?
Thanks,
Drew
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The syntax is almost exactly the same.
You’ll need to declare the
GetAsyncKeyStatemethod like this:Instead of
VK_SHIFT, you can writeKeys.ShiftAlso, C# doesn’t impicitly convert
inttobool, so you’ll need to compare that to0.Therefore, you’ll need to write
However,
You can do this without P/Invoke by checking
Control.ModifierKeys.