(08-17-2024, 04:56 PM)SierraKen Wrote: Thanks Petr! I'm glad you saw this!
I tried your code with Steve's Function and got an error message in the Function. I also don't know how to use the Function with the variables it uses, so I'm just going to drop the 32 bit version (I use the 64 bit QB64), unless anyone wishes to tackle it. But thanks again!
This function?
Code: (Select All)
FUNCTION ConvertOffset&& (value AS _OFFSET)
$CHECKING:OFF
DIM m AS _MEM 'Define a memblock
m = _MEM(value) 'Point it to use value
$IF 64BIT THEN
'On 64 bit OSes, an OFFSET is 8 bytes in size. We can put it directly into an Integer64
_MEMGET m, m.OFFSET,temp&&
ConvertOffset&& = temp&& 'Get the contents of the memblock and put the values there directly into ConvertOffset&&
$ELSE
'However, on 32 bit OSes, an OFFSET is only 4 bytes. We need to put it into a LONG variable first
_MEMGET m, m.OFFSET, temp& 'Like this
ConvertOffset&& = temp& 'And then assign that long value to ConvertOffset&&
$END IF
_MEMFREE m 'Free the memblock
$CHECKING:ON
END FUNCTION
Just plug it in, and on lin 67, make it:
Code: (Select All)
sz = ConvertOffset(SampleData.ELEMENTSIZE)