+ 15

Mouse-clicking on C++ Console App?

Following my previous thread - 'Utilising Arrow Keys in C++' (https://www.sololearn.com/Discuss/210329/?ref=app), this thread is somewhat similar to its predecessor. While I am aware that it is unnecessary (and probably even a waste of time) to go all the way to get clickable buttons on a console, because we'd probably have better tools for that, I've did a lookup related to GetAsyncKeyState, and it seems promising. I'd like to know your recommendations as to how this task should be completed in C++.

16th Mar 2017, 3:58 AM
Hatsy Rei
Hatsy Rei - avatar
1 Odpowiedź
+ 16
As far as I know, GetAsyncKeyState lets you know if a mouse button is pressed or not. You will need to get the dwMousePosition from the MOUSE_EVENT_RECORD structure in the INPUT_RECORD structure using the ReadConsoleInput function. (Check MSDN for better explanations. I don't C++)
16th Mar 2017, 4:30 AM
Jafca
Jafca - avatar