The code Doesnt work while Checking for 2 buttons pressing using GetAsyncKeyState and work when checking for 1 Key

80 views Asked by At

I'm trying to type a code that will show my program when the user press SHIFT + S but the code doesn't work when I type it like that ( to check for SHIFT + S )

if (GetAsyncKeyState(16+115))
{
    ShowWindow(mainhwnd,SW_SHOW);
}

but if I type it like that (to check for SHIFT only or S only) will work!

if (GetAsyncKeyState(16))
{
    ShowWindow(mainhwnd,SW_SHOW);
}

and the problem is not that the SHIFT key changes the case of the letter so the ASCII code of it changed. I try with the ASCII code of the 2 cases and try to replace 16 (the ASCII code of shift key) with VK_LSHIFT and VK_RSHIFT and SHIFT_PRESSED and it doesn't work too

I'm using codeblocks

0

There are 0 answers