subcalls.hlp (Topic list)
MouSetPtrPos (1.2)
Overview                                            Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_MOU
 
USHORT MouSetPtrPos(pmouplPosition, hmou)
PPTRLOC pmouplPosition;    /* address of structure for new mouse position */
HMOU hmou;                 /* mouse handle                                */
 
The MouSetPtrPos function sets the current mouse position to the position
pointed to by the pmouplPosition parameter. If the pointer is visible, the
function moves the mouse pointer to the new location on the screen. The new
position is always in screen units and is relative to the upper-left corner
of the screen.
 
Parameter       Description
────────────────────────────────────────────────────────────────────────────
 
pmouplPosition  Points to the PTRLOC structure that contains the new 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 one of the following:
 
     ERROR_MOUSE_INV_PARMS
     ERROR_MOUSE_NO_DEVICE
 
Comments
 
MS OS/2 hides the pointer if the new position is in the exclusion rectangle
defined by the most recent call to the MouRemovePtr function.
 
Example
 
This example creates a mouse handle and calls the MouSetPtrPos function to
initialize the mouse pointer in the upper-left corner of the screen. It then
calls the MouDrawPtr function to enable the mouse pointer to be drawn:
 
PTRLOC mouplPosition;
HMOU hmou;
MouOpen(0L, &hmou);
mouplPosition.row = 0;                  /* row zero            */
mouplPosition.col = 0;                  /* column zero         */
MouSetPtrPos(&mouplPosition, hmou);     /* sets mouse position */
MouDrawPtr(hmou);
 
See Also
 
MouDrawPtr, MouGetPtrPos, MouOpen, MouRemovePtr, PTRLOC