_MousePosP( ) API Library Routine Example

The following example displays the current mouse pointer position until it detects a left mouse button click.

Visual FoxPro Code

SET LIBRARY TO MOUSEPOP

C Code

#include <pro_ext.h>

void putLong(long n, int width)
{
   Value val;

   val.ev_type = 'I';
   val.ev_long = n;
   val.ev_width = width;

   _PutValue(&val);
}

FAR MousePosPEx(ParamBlk FAR *parm)
{
   Point mousePos;

   while (!_MousePosP(&mousePos))
   {
      _PutStr("\nvertical =");
      putLong(mousePos.v, 5);
      _PutStr("; horizontal =");
      putLong(mousePos.h, 5);
   }
}

FoxInfo myFoxInfo[] = {
   {"ONLOAD", (FPFI) MousePosPEx, CALLONLOAD, ""},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};