_WFindTitle( ) API Library Routine Example

The following example hides the window whose title is passed as an argument.

Visual FoxPro Code

SET LIBRARY TO WFINDTIT
CREATE TABLE X (X C(10))
BROWSE NOWAIT
SET LIBR TO WFINDTIT
= WHIDE("X")

C Code

#include <pro_ext.h>

void FAR WFindTitleEx(ParamBlk FAR *parm)
{
//   For readability:
#define pTITLE ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

   WHANDLE wh;

   if (!_SetHandSize(parm->p[0].val.ev_handle,
      parm->p[0].val.ev_length+1))
   {
      _Error(182); // "Insufficient memory"
   }
   _HLock(parm->p[0].val.ev_handle);
   pTITLE[parm->p[0].val.ev_length] = '\0';
   wh = _WFindTitle(pTITLE);
   _HUnLock(parm->p[0].val.ev_handle);
   _WHide(wh);
}

FoxInfo myFoxInfo[] = {
   {"WHIDE", (FPFI) WFindTitleEx, 1, "C"},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};