HugeArray VBX, Version 1.0, Copyright (c) 1995, Martin Bryant, All Rights Reserved Introduction ------------ The HUGEAR.VBX file is a custom control suitable for use with such programming languages as Visual Basic, Visual C++ and Delphi. It allows programmers to use 'huge' arrays (>64K in size) without resorting to the intricacies of the Windows API. Shareware Notice ---------------- HugeArray VBX is shareware. You are welcome to use it for a trial period but if you continue to use it then please register and support the shareware concept. You may freely copy/distribute the shareware version as long as you make no charge for it. If you register, then you may use it in commercial products with no royalty fee. Thank you for trying HugeArray VBX! You can register by sending œ5 sterling or equivalent foreign currency (cash preferred!) to Martin Bryant, 71 Hunstanton Drive, Brandlesholme, Bury, Lancashire BL8 1XH, England. Registered users receive free updates and a full list of our other products. Constructive comments/criticisms welcome at the above address or email martinbr@colossus.demon.co.uk Compatibility ------------- HUGEAR.VBX is compatible with level 1 VBX controls. Appearance ---------- When added to a program the control appears in the toolbox as a 'huge' letter 'H'. It is non-sizable on a form and is invisible at run-time. Properties ---------- In addition to the standard properties of Name, Index, Left and Top it also has the following custom properties... About (read only) Gives version information. ArraySize Defines the number of elements (NOT the number of bytes) in the array. e.g. HugeArray1.ArraySize = 1000000 will define the array to have one million elements. ArrayPointer (read only/run time only) Returns a pointer (as a Long) to the first byte of the array. This may be useful if you need to pass the address of the array to another procedure. ElementSize Defines the number of bytes per array element. e.g. HugeArray1.ElementSize = 2 will define each element to have 2 bytes. Common VB data types have the following sizes:- Integer(2), Long(4), Single(4), Double(8), Currency(8). Element Specifies the array element to read/write. e.g. HugeArray1.Element = 999 tells the control that the next read/write will be from/to element number 999. (Note that the array is 0-based, so the first element is numbered 0.) DataPointer Points to a program variable to/from which to write/read one elements data. e.g. Dim i As Integer HugeArray1.DataPointer = Lstrcpy(i,i) tells the control that the next read/write will be into/out of variable i. Note: the Lstrcpy function needs to be defined thus... Declare Function Lstrcpy Lib "kernel" (p1 As Any, p2 As Any) As Long Action (write-only/run-time only) Set to a value to perform the following tasks... 0 - allocate memory for the array 1 - deallocate memory for the array 2 - read an element 3 - write an element 4 - initialise whole array Error (read-only/run-time only) May return an error number as follows... 0 - no error 1 - tried to allocate memory before deallocating previously allocated memory 2 - Windows could not allocate the requested memory 3 - tried to deallocate memory when none had been allocated 4 - tried to read/write element when no memory had been allocated The following code segment creates a huge array of one million integers, initialises each element to -99, sets the 999999th element to 5, reads back and displays the last 3 elements, and finally deallocates the memory. Dim i As Integer hugearray1.ArraySize = 1000000 'one million elements hugearray1.ElementSize = 2 '2 bytes per element hugearray1.Action = 0 'allocate 2 millions bytes of memory for array i = -99 'initialise whole array to -99 hugearray1.DataPointer = Lstrcpy(i, i) hugearray1.Action = 4 i = 5 'set 999,999th element to 5 hugearray1.Element = 999999 - 1 'compensate for 0-base hugearray1.Action = 3 hugearray1.Element = 999998 - 1 'display last three elements hugearray1.Action = 2 MsgBox i & "" hugearray1.Element = 999999 - 1 hugearray1.Action = 2 MsgBox i & "" hugearray1.Element = 1000000 - 1 hugearray1.Action = 2 MsgBox i & "" hugearray1.Action = 1 'deallocate memory The default Name property prefix and class name is 'HugeArray'. Events ------ The control has no pre-defined events.