im having problems with creating a "dynamic variable". Let's say i have an editbox with numbers in it, when i push a button the number in that edit box is INCREASED by 1 and is copied to a variable. what i want is to have another button that is when it is pushed, the variable is allocated into another memory block/space.
Posted on 2003-07-03 11:22:00 by Ni?o
Search forum for HeapAlloc and stuff.
Posted on 2003-07-03 11:55:17 by AceEmbler
Use the stack if you want


sub esp, xx
mov edi, esp
...
add esp,xx ; very crucial code if not the return address is wrong
Posted on 2003-07-03 12:02:10 by roticv
i have tried heapalloc... i just cant get it working. what i want is the same variable on another memory address when i push the button. (im sorry my engilsh bad)
Posted on 2003-07-03 14:35:22 by Ni?o
I'm using this two macros.

INITGROWABLEHEAP MACRO hHEAP,pHEAPMEM
invoke HeapCreate,HEAP_NO_SERIALIZE,0,0
mov hHEAP,eax
invoke HeapAlloc,hHEAP,HEAP_NO_SERIALIZE or HEAP_ZERO_MEMORY,0
mov pHEAPMEM,eax
ENDM



DEINITGROWABLEHEAP MACRO hHEAP,pHEAPMEM
invoke HeapFree,hHEAP,HEAP_NO_SERIALIZE,pHEAPMEM
invoke HeapDestroy,hHEAP
ENDM


But pHEAPMEM in DEINITGROWABLEHEAP must point to the end of the engaged space in heap.


So if u fill pHEAPMEM with 2 bytes u need to add two to pHEAPMEM befor HeapFree.

Heap is growable so u just fill it with numbers and dont worry about it's size :P. For strings it's just more then enought :)
Posted on 2003-07-03 15:38:38 by AceEmbler
GlobalAlloc?
Posted on 2003-07-05 03:22:09 by Vortex

GlobalAlloc?


is this a question ??
Posted on 2003-07-05 05:36:11 by AceEmbler
don't globalalloc.
Posted on 2003-07-05 11:08:30 by f0dder
Hahaha... I think f0dder have alot of comments when it comes to memory allocation. :grin: Ah ya best to use the stack. :)
Posted on 2003-07-05 12:15:23 by roticv
is there a sourcecode available that employs this?
Posted on 2003-07-07 00:02:43 by EEDOK