The coordinates are stored in the INPUT_RECORD structure.
Code:
INPUT_RECORD myinput_record;
DWORD num;
ReadConsoleInput(hStdin,&myinput_record,1,&num);
myinput_record.Event.MouseEvent.dwMousePosition.X
myinput_record.Event.MouseEvent.dwMousePosition.Y
Here is a short example
Code:
#include <windows.h>
#include <iostream>
using namespace std;
int main(void)
{
HANDLE hStdin,hStdout;
hStdin=GetStdHandle(STD_INPUT_HANDLE);
hStdout=GetStdHandle(STD_OUTPUT_HANDLE);
DWORD num;
INPUT_RECORD inputrecord;
COORD location;
location.X=0;
location.Y=0;
while(1)
{
ReadConsoleInput(hStdin,&inputrecord,1,&num);
switch(inputrecord.EventType)
{
case MOUSE_EVENT:
SetConsoleCursorPosition(hStdout,location);
cout<<"mouse_position ";
cout<<inputrecord.Event.MouseEvent.dwMousePosition.X;
cout<<" "<<inputrecord.Event.MouseEvent.dwMousePosition.Y<<" \n";
break;
}
}
return 0;
}