Well, yes. But you'd have to keep polling GetASyncKeyState:
If the function succeeds, the return value specifies whether the key was pressed since the last call to GetAsyncKeyState, and whether the key is currently up or down. If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState.
|
In theory, you could check the least significant bit. But since windows is a multitasking OS, you do NOT do that (another application could call GetASyncKeyState before you), instead you do it with the polling method:
You check GetASyncKeyState in a loop. If GetASyncKeyState(VK_RBUTTON) is not 0, you set a variable that you could call rightState or something like that to true. If it is 0, you check whether rightState is true or not, if it is the user has pressed and released the right button - you set rightState to false and do whatever you want to do with the right mouse button being released.
This is unreliable for 2 reasons:
It doesn't work if the user clicks and release faster than your program takes for one loop.
It doesn't work if the user clicks, released and then clicks again faster than your program.
BUT, since on modern machines you can do this so fast that no human could really keep up, you can usually ignore both of these.
But really, if you are already programming for windows, and want mouse input, why do you not want to use a window? *scratches head* makes no sense to me.