Links are not active on this page.
 _MousePos( ) API Library Routine

Fills in pt with the current position of the mouse pointer.

int _MousePos(Point FAR *pt)
Point FAR *pt;               /* Pointer. */

Expand imageRemarks

_MousePos( ) returns True (an integer other than 0) if the left mouse button is down when the function is called, or False (0) if the left mouse button isn't down.

For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.

Expand imageExample

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

Visual FoxPro Code

 CopyCode imageCopy Code
SET LIBRARY TO MOUSEPOS

C Code

 CopyCode imageCopy 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 MousePosEx(ParamBlk FAR *parm)
{
   Point mousePos;
   while (!_MousePos(&mousePos))
   {
      _PutStr("\nvertical =");
      putLong(mousePos.v, 5);
      _PutStr("; horizontal =");
      putLong(mousePos.h, 5);
   }
}
FoxInfo myFoxInfo[] = {
   {"ONLOAD", (FPFI) MousePosEx, CALLONLOAD, ""},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

Expand imageSee Also