mouse(int* x, int* y, HWND hWnd): int

Returns the mouse button state and mouse coordinates, relative to a window or to the screen.

Parameters:

x, y - pointers to int variables to be filled with the mouse coordinates.
hWnd - window handle as returned by the window function, or 0 for returning the mouse position in screen coordinates.

Returns:

0 for no mouse button pressed down, 1 for left, 2 for right, 4 for middle button.

Remarks:

Example:

void main()
{
  while(wait(50)) {
    int x,y;
    HWND h = window("Script Editor");
    int button = mouse(&x,&y,h);
    printf("\r%04d %04d %d",x,y,button);
  }
}

See also:

window, keys

► latest version online