JavaScript Editor js editor     Web development 

Main Page

Changes the amount of memory allocated to the memory block handle hand.

unsigned short _SetHandSize(MHANDLE hand, unsigned long size)
MHANDLE hand;            /* Memory block handle. */
unsigned int size;            /* New number of bytes. */


_SetHandSize(В ) returns True (an integer other than 0) if the reallocation is successful, or False (0) if the reallocation fails. The data associated with the MHANDLE is preserved. If hand is a locked MHANDLE, _SetHandSize(В ) fails.

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


The following example uses _SetHandSize(В ) to change the amount of memory allocated to an MHANDLE.

Visual FoxPro Code

В Copy Code
= HANDTOPTR("Hello, world.") && displays "Hello, world" on screen

C Code

В Copy Code
#include <pro_ext.h>

void NullTerminate(Value FAR *cVal)
   if (!_SetHandSize(cVal->ev_handle, cVal->ev_length + 1))
      _Error(182); // "Insufficient memory"
   ((char FAR *) _HandToPtr(cVal->ev_handle))[cVal->ev_length] = '\0';

FAR Example(ParamBlk FAR *parm)


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

See Also

JavaScript Editor js editor     Web development