JavaScript Editor js editor     Web development 



Main Page

_EdLastError(В ) returns the error number of the most recent editor error associated with the specified editing window.

int _EdLastError(WHANDLE wh)
WHANDLE wh;            /* Handle of editing window. */

Example

The following example displays the error code returned by _EdLastError(В ) after a number of editor operations. Since editor errors are reserved for severe situations, such as low memory, the following example will usually display an error code of 0.

Visual FoxPro Code

В Copy Code
SET LIBRARY TO EDLASTER
= EDLASTERR("x")  && displays _EdLastError() after operations on file "x"

C Code

В Copy Code
#include <pro_ext.h>

void putLong(long n)
{
   Value val;

   val.ev_type = 'I';
   val.ev_long = n;
   val.ev_width = 10;
   _PutValue(&val);
}

FAR Example(ParamBlk FAR *parm)
{
   char FAR *pFileName;
   WHANDLE wh;
   EDENV EdEnv;

   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);
   pFileName = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);
   pFileName[parm->p[0].val.ev_length] = '\0';

   wh = _EdOpenFile(pFileName, FO_READONLY);
   _HUnLock(parm->p[0].val.ev_handle);

//   Position past end of file
   _EdGetEnv(wh, &EdEnv);
   _EdSetPos(wh, EdEnv.length + 128);
   _PutStr("\n_EdLastError() ="); putLong(_EdLastError(wh));

//   _EdCopy() with no selection
   _EdSetPos(wh, 1);
   _EdCopy(wh);
   _PutStr("\n_EdLastError() ="); putLong(_EdLastError(wh));

//   _EdScrollToSel() with no selection
   _EdScrollToSel(wh, TRUE);
   _PutStr("\n_EdLastError() ="); putLong(_EdLastError(wh));
}

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

See Also



JavaScript Editor js editor     Web development