I have been working with several classes that copy various data structures into and out of blocks of memory to be able to pass them to various API calls.
I got an idea for a new class that I think would work better if the data was actually stored in a block of memory. Not having used the Memory Allocation routines much myself, I don't know which routines would be best to use.
I thought of doing the usual, and setting up a UDT to hold the data; but the data can be of different sizes for each instance of the object. Also several of the UDT elements have allignment issues, so VB fills in with extra bytes that will make many of the methods much more complex having to compinsate for the extra bytes. Calling API routines, and storing the data suffer the most from these allignment issues.
I thought for this class that the data could be in a single block of memory and therefore avoid the allignment and dynamic size issues.
So my questions are:
Which routines would be best? (Global, Local, Heap, Vitural, File Mapped?)
Would I need to use the memory Lock and Unlock routines, and if so when do I need to lock memory and when should I unlock it?
What clean up do I need to do when the object is terminated?
Thanks!