_WClearRect( ) API Library Routine Example

The following example creates a window and fills it with Xs. After the user presses a key in response to a Visual FoxPro WAIT command, _WClearRect( ) clears a rectangular region of the window.

Visual FoxPro Code

SET LIBRARY TO WCLRECT 

C Code

#include <pro_ext.h>

FAR WClearEx(ParamBlk FAR *parm)
{
   WHANDLE wh;
   int row, col;
   Rect r;

   wh = _WOpen(2,2,20,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *) 0,
      WO_SYSTEMBORDER);
   _WShow(wh);

   for (row = 0; row < _WHeight(wh); row++)
   {
      for (col = 0; col < _WWidth(wh); col++)
      {
         _WPutChr(wh, 'X');
      }
   }
   _Execute("WAIT WINDOW 'Press any key to clear window rectangle'");

   r.top    = 2;
   r.left    = 2;
   r.bottom = 15;
   r.right  = 65;

   _WClearRect(wh, r);
}

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