mouse(int* x, int* y, HWND hWnd): int
Returns the mouse button state and mouse coordinates relative to a window.
x, y - pointers to int variables to be filled with the mouse coordinates.
hWnd - window handle for returning mouse coordinates relative to the upper left corner, or 0 for returning screen coordinates.
0 for no mouse button pressed down, 1 for left, 2 for right, 4 for middle button.
- The mouse function can be used for calibrating the positions of "Buy" and "Sell" buttons on a broker's web interface, f.i. for binary options. Automated buying and selling can then be performed by clicking those buttons with the keys function.
HWND h = window("Script Editor");
int button = mouse(&x,&y,h);
printf("\r%04d %04d %d",x,y,button);