The Allocate function allocates memory space for data used by External DLL functions within a script.
Used to allocate memory before using External$ function.
<size>. integer, size of the space to allocate (size in bytes).
address, unsigned, pointer to the allocated memory. Use Dim function to declare at the beginning of the script the unsigned variable.
If the allocation fails, the return value is 0.
dim MemPointer as unsigned
'This script displays the folder name where Windows is installed.
'It calls the GetWindowsDirectoryA API function, using a pointer.
'Declare a variable to hold the memory address
dim pointer as unsigned
'reserve a 64-byte memory space
'prepare a string to place in memory
'writes the zero-terminated string to memory
'In Win32, an A must be added to function which return a string
'read the string through its memory address
'Display the returned string