Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problems with DECLARE command
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00753679
Message ID:
00753741
Vues:
18
Well, it should be a way to avoid allocating such an amount of memory.

Only if there is no other choice but to allocate do it this way:

- in declaration change from STRING @ to INTEGER
- allocate memory not with Repli(Chr(0), nBytes) but with GlobalAlloc, like the following:

DECLARE INTEGER GlobalFree IN kernel32 INTEGER hMem
DECLARE INTEGER GlobalSize IN kernel32 INTEGER hMem

DECLARE INTEGER GlobalAlloc IN kernel32;
INTEGER wFlags, INTEGER dwBytes

LOCAL hMem, nSize
nSize = 26 * 1024 * 1024

hMem = GlobalAlloc(0, nSize)

? 'Handle to allocated memory:', hMem
? 'Bytes allocated:', GlobalSize(hMem)

* do not forget to release memory block
= GlobalFree(hMem)

* * *
Pass INTEGER hMem to your external function instead of that parameter you previously passed as STRING.

* * *
After an external function returns, find ways to parse allocated memory block or to copy its smaller parts to FoxPro strings. You can even use this handle hMem to store the content to a file. So many choices :)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform