I am using
public static bool IsKeyPushedDown(Keys vKey)
{
return 0 != (GetAsyncKeyState((int)vKey) & 0x8000);
}
but I don’t know how to combine 2 keys.
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.
Something like
if (IsKeyPushedDown('B') && IskeyPushedDown(VK_CONTROL))perhaps?As others have stated in comments using the events WM_KEYDOWN or WM_CHAR to check for “someone pressed a key” is indeed the “right” solution for “I want to call a function when someone presses a key”. However, you specifically asked “I’m using ..some code.. I don’t know how to combine 2 keys”, which the above is definitely the correct answer to.