home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
QBAS
/
HUGEARR.ZIP
/
HUGEGETN.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-02
|
1KB
|
44 lines
#define NOCOMM
#include <windows.h>
#include <memory.h>
#include "hugearr.h"
/* Copy multiple huge array elements into multiple VB array elements. */
/* VBM: Declare Function VBHugeGetNum% Lib "hugearr.dll" Alias "VBHugeGetNum" (ByVal Index%, ByVal el&, ByVal nelem%, buffer As Any) */
int FAR PASCAL
VBHugeGetNum(int hArray, long element, int nelem, LPBYTE buffer)
{
HPBYTE ToBegin;
HPBYTE ToElem; /* pointer to array element */
PHUGEDESC pArray; /* pointer to array descriptor */
DecCheckHandle(hArray);
/* point to proper descriptor */
pArray = (PHUGEDESC) LocalLock(hLocalMem) + hArray;
CheckNotAllocYet(pArray);
CheckSubscript(pArray, element, element + nelem - 1);
/* calculate pointer to element */
ToBegin = (HPBYTE) GlobalLock(pArray -> handle);
while (nelem-- > 0)
{
ToElem = ToBegin + HugeElementOffset(element, pArray->perseg, pArray->recsize);
/* copy one element of data */
_fmemcpy(buffer, ToElem, pArray -> recsize);
/* increment pointer to VB array to point to next element. */
buffer += pArray -> recsize;
element ++;
}
GlobalUnlock(pArray -> handle);
LocalUnlock(hLocalMem);
return HA_OK;
}