Pointers arithmetic in VB ?
Posted on 2006-04-18
Hello experts !
I has pointer of memory using return value from MapViewOfFile and then by RtlMoveMemory read/write data.
Publuc Type TROI
Xxx as long
Yyy as long
Dim ROI as TROI, P as long
P = MapViewOfFile(HANDLE_MapedFile, FILE_MAP_WRITE, 0, 0, Len(ROI))
CopyMemory ByVal P, ROI, Len(ROI)
Now I have to access memory with some offset from this pointer – let say 2x Len(ROI). A am pretty sure what I have in offset.
Can I make next ?
Dim ROI2 as TROI
CopyMemory ByVal (P+ Len(ROI2)), ROI2, Len(ROI)
Will this will work ALWAYS ? As I know pointers are LONG (DWORD), but has NO sign, while in VB6 Long has sign. Does (P+ Len(ROI)) will produce error if P is negative ?