Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DAY 031: BYVAL
#9
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
Tread on those who tread on you

Reply


Messages In This Thread
DAY 031: BYVAL - by Pete - 12-12-2022, 02:37 AM
RE: DAY 031: BYVAL - by mnrvovrfc - 12-12-2022, 08:43 AM
RE: DAY 031: BYVAL - by SpriggsySpriggs - 12-14-2022, 05:01 PM
RE: DAY 031: BYVAL - by Pete - 12-14-2022, 07:15 PM
RE: DAY 031: BYVAL - by SMcNeill - 12-14-2022, 07:57 PM
RE: DAY 031: BYVAL - by SpriggsySpriggs - 12-14-2022, 08:06 PM
RE: DAY 031: BYVAL - by Pete - 12-14-2022, 08:10 PM
RE: DAY 031: BYVAL - by mnrvovrfc - 12-14-2022, 09:06 PM
RE: DAY 031: BYVAL - by SpriggsySpriggs - 12-14-2022, 09:18 PM



Users browsing this thread: 1 Guest(s)