Admin Production ni-theme
Current Publication

GetGlobalMouseState

LabWindows/CVI

GetGlobalMouseState

int GetGlobalMouseState (int *panelHandle, int *xCoordinate, int *yCoordinate, int *leftButtonDown, int *rightButtonDown, int *keyModifiers);

Purpose

Obtains information about the state of the mouse cursor. xCoordinate and yCoordinate return the position of the mouse relative to the top, left corner of the screen.

Parameters

Output
Name Type Description
panelHandle int Handle of the panel that the mouse is over.

panelHandle is 0 if the mouse is not over a panel.

You can pass NULL.
xCoordinate int X-coordinate of the mouse cursor relative to the left edge of the screen.

You can pass NULL.
yCoordinate int Y-coordinate of the mouse cursor relative to the top of the screen.

You can pass NULL.
leftButtonDown int The state of the left mouse button.

0 if the left button is up. 1 if the left button is down.

You can pass NULL.
rightButtonDown int The state of the right mouse button.

0 if the right button is up. 1 if the right button is down.

You can pass NULL.
keyModifiers int State of the keyboard modifiers, in other words, the <Ctrl>, <Alt>, and <Shift> keys.

If no keys are down, the value is 0. Otherwise, the value is the bitwise OR of the appropriate key masks: VAL_MENUKEY_MODIFIER, VAL_UNDERLINE_MODIFIER, VAL_SHIFT_MODIFIER, and VAL_SHIFT_AND_MENUKEY.

You can pass NULL.

Return Value

Name Type Description
status int Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later

Examples

Refer to the following examples that use the GetGlobalMouseState function:

  • userint\moustate.cws

    Open example
  • userint\multimonitor.cws

    Open example