Share via


_EdSelect( ) API Library Routine

Selects the range between the two specified offset positions, inclusive, of the file in the designated editing window.

void _EdSelect(WHANDLE wh, EDPOS startPos, EDPOS endPos)
WHANDLE wh;            /* Handle of editing window. */
EDPOS startPos;         /* Beginning offset position of selection. */
EDPOS endPos;         /* Ending offset position of selection. */

Example

The following example opens for editing a file specified by a parameter, selects the first character in the file using _EdSelect( ), copies the selection to the clipboard using _EdCopy( ), and pastes it after the second character using _EdPaste( ).

Visual FoxPro Code

SET LIBRARY TO EDSELECT
= EDCOPY("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;

   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);
   _EdCopy(wh);
   _EdSetPos(wh, 2);
   _EdPaste(wh);
}

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

See Also

Reference

_EdCopy( ) API Library Routine

_EdCut( ) API Library Routine

_EdPaste( ) API Library Routine

Other Resources

API Library Construction