12-14-2022, 09:18 PM
Most external libraries (WinAPI especially) will expect things like arrays or structs to be passed as a pointer. _OFFSET allows us to pass the pointer to these items. You'd do
_OFFSET(myArray()) or _OFFSET(myUDT)
You just want to make sure that the argument for the function is BYVAL so it gets the value of the address.
WinAPI to QB64:
BYTE -> BYTE
WORD -> UNSIGNED INTEGER
DWORD -> UNSIGNED LONG
QWORD -> UNSIGNED INTEGER64
void* or most arguments that start with "h" or "p", handles -> OFFSET
Handles/pointers/"h"/"p" are 4 bytes in 32 bit and 8 bytes in 64. We use OFFSET for these to automate this switching of size.
All of the above would be passed with BYVAL
_OFFSET(myArray()) or _OFFSET(myUDT)
You just want to make sure that the argument for the function is BYVAL so it gets the value of the address.
WinAPI to QB64:
BYTE -> BYTE
WORD -> UNSIGNED INTEGER
DWORD -> UNSIGNED LONG
QWORD -> UNSIGNED INTEGER64
void* or most arguments that start with "h" or "p", handles -> OFFSET
Handles/pointers/"h"/"p" are 4 bytes in 32 bit and 8 bytes in 64. We use OFFSET for these to automate this switching of size.
All of the above would be passed with BYVAL
Tread on those who tread on you