I went poking around the web for about seven hours, and found some code that detects console button presses. Oddly enough, it doesnt work proporely. Because the code wasnt specificaly related to mouse clicking, I'm not sure if I copied the code correctly. I altered it a bit, looked up some other stuff, but I cant find anything else.
Well, heres my newely revised code:
Code:
#include <iostream.h>
#include <windows.h>
#include <conio.h>
using namespace std;
int main() {
INPUT_RECORD rec;
DWORD evk;
HANDLE hIn = GetStdHandle(STD_INPUT_HANDLE);
int x_pos, y_pos;
SetConsoleMode(hIn, ENABLE_MOUSE_INPUT);
for(;;) {
ReadConsoleInput(hIn, &rec, 1, &evk);
if(rec.EventType == MOUSE_EVENT)
if(rec.Event.MouseEvent.dwButtonState != FROM_LEFT_1ST_BUTTON_PRESSED) {
x_pos = rec.Event.MouseEvent.dwMousePosition.X;
y_pos = rec.Event.MouseEvent.dwMousePosition.Y;
break;
}
}
cout << x_pos << " " << y_pos;
}
For some reason, this sets off whenever you move your mouse on the console... Hmmm... Anyone?