subcalls.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
MouGetPtrPos (1.2)
Overview                                            Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_MOU
 
USHORT MouGetPtrPos(pmouplPosition, hmou)
PPTRLOC pmoupl;    /* address of structure for current mouse position */
HMOU hmou;         /* mouse handle                                    */
 
The MouGetPtrPos function retrieves the current position of the mouse
device. This position is given in screen coordinates.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
pmoupl     Points to the PTRLOC structure that receives the coordinates of
           the mouse position.
 
hmou       Identifies the mouse. The handle must have been created
           previously by using the MouOpen function.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be the following:
 
     ERROR_MOUSE_NO_DEVICE
 
Comments
 
The current device status as defined by the MouSetDevStatus function does
not affect the row and col fields of the PTRLOC structure. These fields
always specify an absolute position relative to the upper-left corner of the
screen.
 
Example
 
This example creates a mouse handle and enables the mouse pointer to be
drawn. It then displays the text "Place mouse here" at the top of the screen
and repeatedly calls the MouGetPtrPos function until the mouse is moved over
the text:
 
PTRLOC moupl;
HMOU hmou;
BYTE bAttr = 0x72;      /* green character on white background */
MouOpen(0L, &hmou);
MouDrawPtr(hmou);
VioWrtCharStrAtt("Place mouse here", 16, 0, 35, &bAttr, 0);
do
    MouGetPtrPos(&moupl, hmou);
while (moupl.row != 0 || (moupl.col < 35 || moupl.col > 50));
 
See Also
 
MouOpen, MouSetDevStatus, MouSetPtrPos, PTRLOC