To determine whether the mouse pointer lies within a region:
The following figure shows how to locate the mouse pointer with respect to a region.
#define INCL_GPIREGIONS#include <os2.h>
void fncREGN04(void){
POINTL ptlCurPos; /* Mouse coordinates */
HPS hps; /* Presentation-space handle */
HRGN hrgn; /* Region handle */
LONG lPosition; /* Return value for GpiPtInRegion */
/* Determine mouse coordinates and store in ptlCurPos. */
lPosition = GpiPtInRegion(hps, hrgn, &ptlCurPos);
if (lPosition == PRGN_INSIDE) {
.
. /* Point lies within region. */
.
} /* if */
else if (lPosition == PRGN_OUTSIDE) {
.
. /* Point lies outside region. */
.
} /* else-if */