Hi, if I define a structure in VB, what is the most common way to reserve memory for it. Thank you
Printable View
Hi, if I define a structure in VB, what is the most common way to reserve memory for it. Thank you
Dim variablename as structuretype
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
when do you use api call like globalalloc then? Thanks!
You would only need to use GlobalAlloc if you want your data structure to be available to another application than the one it is declared in...and it is a pain to use from VB!
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
Just declare it. There's a garbage collector in VB and you should be ok. Most VB arrays can be dynamically expanded and reduced and the same is true for strings. The good thing is that it is transparent and you don't need to do the mechanics to allocate new memory just like C++ or other language. Arrays are treated a bit differently and at least you get a fault if you try to access out of the range of it.