| A function that returns the address, ie. pointer to, of the given variable name. Variable must be a declared variable, ie. not a component variable such as QForm.Caption
Syntax: VARPTR(variablename) Addr& = VARPTR(MyString$) Addr& = VARPTR(MyArray(0)) 'be sure to reference the first element of your array Details: You can only get pointers to basic datatypes like INTEGER, SINGLE, DOUBLE. Pointers to Qobjects and components (like OBJPTR in visual basic) are not
supported.
Use UDTPTR for User Defined Types. Unlike C/C++, you cannot get a pointer of a member inside a
UDT : VARPTR(MyRec.NumRecords) 'this
won't work
Also you cannot access an array pointer once the array is passed to a
SUB/FUNCTION
SUB MySub (MyArray () AS INTEGER)
addr = VARPTR(MyArray(0)) '
doesn't recognize MyArray !
END SUB
So if you want to fast copy data to your array using MEMCPY
then you will have to also pass the address of the array | |