Jump to content

MouGetPtrPos: Difference between revisions

From EDM2
Created page with "==Description== This call queries the mouse driver to determine the current row and column coordinate position of the mouse pointer. ==Syntax== <PRE> MouGetPtrPos (PtrP..."
 
mNo edit summary
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
==Description==
This call queries the mouse driver to determine the current row and column coordinate position of the mouse pointer.
This call queries the mouse driver to determine the current row and column coordinate position of the mouse pointer.


==Syntax==
==Syntax==
<PRE>
  MouGetPtrPos(PtrPos, DeviceHandle);
  MouGetPtrPos
 
    (PtrPos, DeviceHandle)
</PRE>


==Parameters==
==Parameters==
; PtrPos (PPTRLOC) - output : Address of the mouse pointer position structure:
;PtrPos (P[[PTRLOC]]) - output: Address of the mouse pointer position structure.
;DeviceHandle (HMOU) - input: Contains the handle of the mouse device obtained from a previous MouOpen.


pointerrow (USHORT) : Current pointer row coordinate (pels or characters).
==Return Code==
;rc (USHORT) - return:Return code descriptions are:
*0 NO_ERROR
*385 ERROR_MOUSE_NO_DEVICE
*466 ERROR_MOU_DETACHED
*501 ERROR_MOUSE_NO_CONSOLE
*505 ERROR_MOU_EXTENDED_SG


pointercol (USHORT) : Current pointer column coordinate (pels or characters).  
==Sample==
<PRE>
#define INCL_MOU
#include <os2.h>


; DeviceHandle (HMOU) - input : Contains the handle of the mouse device obtained from a previous MouOpen.  
PPTRLOC    PtrPos;       /* Pointer to the mouse pointer data structure. */
HMOU      DeviceHandle;  /* Reserved.  Must be 0. */
APIRET    rc;            /* Return code. */


==Return Code==
rc = MouGetPtrPos(PtrPos, DeviceHandle);
rc (USHORT) - return
</PRE>


Return code descriptions are:
* 0          NO_ERROR
* 385        ERROR_MOUSE_NO_DEVICE
* 466        ERROR_MOU_DETACHED
* 501        ERROR_MOUSE_NO_CONSOLE
* 505        ERROR_MOU_EXTENDED_SG


==Remarks==
==Remarks==
For a text window (VIO) application, the text window is a view on the larger logical video buffer (LVB). The mouse pointer can be outside that view and still be within the extent of the LVB. MouGetPtrPos then returns the coordinates of the cell under the mouse pointer. If the pointer is outside the LVB image extent, the coordinates of the nearest LVB cell are returned. In either case, the LVB is scrolled until the reported LVB cell appears within the view window.  
For a text window (VIO) application, the text window is a view on the larger logical video buffer (LVB). The mouse pointer can be outside that view and still be within the extent of the LVB. MouGetPtrPos then returns the coordinates of the cell under the mouse pointer. If the pointer is outside the LVB image extent, the coordinates of the nearest LVB cell are returned. In either case, the LVB is scrolled until the reported LVB cell appears within the view window.


==Example Code==
==Bindings==
=== C Binding===
===C===
<PRE>
<PRE>
typedef struct _PTRLOC {   /* moupl */
typedef struct _PTRLOC { /* moupl */
   USHORT row;               /* pointer row coordinate screen
   USHORT row;           /* pointer row coordinate screen position */
                                position */
   USHORT col;           /* pointer column coordinate screen position */
   USHORT col;               /* pointer column coordinate screen
                                position */
} PTRLOC;
} PTRLOC;


Line 52: Line 50:
</PRE>
</PRE>


===MASM Binding===
===MASM===
<PRE>
<PRE>
PTRLOC  struc
PTRLOC  struc
Line 69: Line 67:
</PRE>
</PRE>


==Related Functions==
[[Category:Mou]]
*
 
[[Category:The OS/2 API Project]]

Latest revision as of 15:26, 29 February 2020

This call queries the mouse driver to determine the current row and column coordinate position of the mouse pointer.

Syntax

MouGetPtrPos(PtrPos, DeviceHandle);

Parameters

PtrPos (PPTRLOC) - output
Address of the mouse pointer position structure.
DeviceHandle (HMOU) - input
Contains the handle of the mouse device obtained from a previous MouOpen.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 385 ERROR_MOUSE_NO_DEVICE
  • 466 ERROR_MOU_DETACHED
  • 501 ERROR_MOUSE_NO_CONSOLE
  • 505 ERROR_MOU_EXTENDED_SG

Sample

#define INCL_MOU
#include <os2.h>

PPTRLOC    PtrPos;        /* Pointer to the mouse pointer data structure. */
HMOU       DeviceHandle;  /* Reserved.  Must be 0. */
APIRET     rc;            /* Return code. */

rc = MouGetPtrPos(PtrPos, DeviceHandle);


Remarks

For a text window (VIO) application, the text window is a view on the larger logical video buffer (LVB). The mouse pointer can be outside that view and still be within the extent of the LVB. MouGetPtrPos then returns the coordinates of the cell under the mouse pointer. If the pointer is outside the LVB image extent, the coordinates of the nearest LVB cell are returned. In either case, the LVB is scrolled until the reported LVB cell appears within the view window.

Bindings

C

typedef struct _PTRLOC { /* moupl */
  USHORT row;            /* pointer row coordinate screen position */
  USHORT col;            /* pointer column coordinate screen position */
} PTRLOC;

#define INCL_MOU

USHORT  rc = MouGetPtrPos(PtrPos, DeviceHandle);

PPTRLOC          PtrPos;        /* Double word structure */
HMOU             DeviceHandle;  /* Mouse device handle */

USHORT           rc;            /* return code */

MASM

PTRLOC  struc
  moupl_row  dw  ? ;pointer row coordinate screen position
  moupl_col  dw  ? ;pointer column coordinate screen position
PTRLOC  ends

EXTRN  MouGetPtrPos:FAR
INCL_MOU            EQU 1

PUSH@  OTHER   PtrPos        ;Double word structure
PUSH   WORD    DeviceHandle  ;Mouse device handle
CALL   MouGetPtrPos

Returns WORD