ClassesClassesClassesClasses | | | | Operators

get_mpositionget_mpositionGetMpositionget_mpositionGetMpositionGetMposition (Operator)


get_mpositionget_mpositionGetMpositionget_mpositionGetMpositionGetMposition — Query the mouse position.


get_mposition( : : WindowHandle : Row, Column, Button)

Herror get_mposition(const Hlong WindowHandle, Hlong* Row, Hlong* Column, Hlong* Button)

Herror T_get_mposition(const Htuple WindowHandle, Htuple* Row, Htuple* Column, Htuple* Button)

Herror get_mposition(const HTuple& WindowHandle, Hlong* Row, Hlong* Column, Hlong* Button)

Hlong HWindow::GetMposition(HTuple* Column, HTuple* Button) const

void GetMposition(const HTuple& WindowHandle, HTuple* Row, HTuple* Column, HTuple* Button)

void HWindow::GetMposition(Hlong* Row, Hlong* Column, Hlong* Button) const

void HOperatorSetX.GetMposition(
[in] VARIANT WindowHandle, [out] VARIANT* Row, [out] VARIANT* Column, [out] VARIANT* Button)

Hlong HWindowX.GetMposition(
[out] Hlong* Column, [out] Hlong* Button)

static void HOperatorSet.GetMposition(HTuple windowHandle, out HTuple row, out HTuple column, out HTuple button)

void HWindow.GetMposition(out int row, out int column, out int button)


get_mpositionget_mpositionGetMpositionget_mpositionGetMpositionGetMposition returns the pixel accurate image coordinates of the mouse pointer in the output window and the mouse button pressed. These values are returned regardless of the state of the mouse buttons (pressed or not pressed). If at least one mouse button is pressed, the state of the modfier keys is returned as well. If no mouse button is pressed, get_mpositionget_mpositionGetMpositionget_mpositionGetMpositionGetMposition returns 0 in ButtonButtonButtonButtonButtonbutton, even if a modifier key is pressed. The following values are assigned to the individual buttons and keys:


No button,


Left button,


Middle button,


Right button,


Shift key,


Ctrl key,


Alt key.

The sum of the values for all pressed buttons/keys is returned in ButtonButtonButtonButtonButtonbutton.

The origin of the coordinate system is located in the left upper corner of the window. For graphics windows the coordinates RowRowRowRowRowrow and ColumnColumnColumnColumnColumncolumn are expressed with consideration of the current image part (see set_partset_partSetPartset_partSetPartSetPart). For text windows the coordinates of the upper left corner are (0,0), while the coordinates of the lower right corner are (window height-1,window width-1) (see open_textwindowopen_textwindowOpenTextwindowopen_textwindowOpenTextwindowOpenTextwindow).

If subpixel accurate image coordinates are required, you can use the operator get_mposition_sub_pixget_mposition_sub_pixGetMpositionSubPixget_mposition_sub_pixGetMpositionSubPixGetMpositionSubPix.


get_mpositionget_mpositionGetMpositionget_mpositionGetMpositionGetMposition fails (returns FAIL) if the mouse pointer is not located within the window. In this case, no values are returned.



WindowHandleWindowHandleWindowHandleWindowHandleWindowHandlewindowHandle (input_control)  window HWindow, HTupleHTupleHTupleHWindowX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Window identifier.

RowRowRowRowRowrow (output_control)  point.y HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Row coordinate of the mouse position in the window.

ColumnColumnColumnColumnColumncolumn (output_control)  point.x HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Column coordinate of the mouse position in the window.

ButtonButtonButtonButtonButtonbutton (output_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Mouse button(s) pressed or 0.


get_mpositionget_mpositionGetMpositionget_mpositionGetMpositionGetMposition returns the value 2 (H_MSG_TRUE). If the mouse pointer is not located within the window, 5 (H_MSG_FAIL) is returned.

Possible Predecessors

open_windowopen_windowOpenWindowopen_windowOpenWindowOpenWindow, open_textwindowopen_textwindowOpenTextwindowopen_textwindowOpenTextwindowOpenTextwindow


get_mbuttonget_mbuttonGetMbuttonget_mbuttonGetMbuttonGetMbutton, get_mposition_sub_pixget_mposition_sub_pixGetMpositionSubPixget_mposition_sub_pixGetMpositionSubPixGetMpositionSubPix, get_mbutton_sub_pixget_mbutton_sub_pixGetMbuttonSubPixget_mbutton_sub_pixGetMbuttonSubPixGetMbuttonSubPix

See also

open_windowopen_windowOpenWindowopen_windowOpenWindowOpenWindow, open_textwindowopen_textwindowOpenTextwindowopen_textwindowOpenTextwindowOpenTextwindow



ClassesClassesClassesClasses | | | | Operators