_EdDelete( ) API Library Routine

Deletes the selected portion of the file in the specified editing window.

void _EdDelete(WHANDLE wh)
WHANDLE wh;            /* Handle of editing window. */

Remarks

If nothing is selected, _EdDelete( ) deletes the character at the current insertion point position.

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

Example

The following example opens for editing a file specified by a parameter and deletes the first character in the file using _EdDelete( ).

Visual FoxPro Code

SET LIBRARY TO EDDELETE
= EDDELETE("x")

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)
{
#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

   WHANDLE wh;
   int retValue;

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

   _HLock(parm->p[0].val.ev_handle);
   wh = _EdOpenFile(pFILENAME, FO_READWRITE);
   _HUnLock(parm->p[0].val.ev_handle);

   _EdSelect(wh, 0, 1);
   _EdDelete(wh);
}

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

See Also

Reference

_EdGetPos( ) API Library Routine
_EdSelect( ) API Library Routine
_EdSetPos( ) API Library Routine

Other Resources

API Library Construction
Accessing the Visual FoxPro API