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

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

Parameters:

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.

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