ItemPointer
(Available in 00 TS Tools(Base) - TS_Tools_PointerSafe)
Purpose
Get a pointer to an item
Syntax
pGUID:=oPointerSafe( 6 )
Arguments
Description
Get a pointer to the 'dwItem'th item in the allocated memory, if the requested item is out of bounds a NULL_PTR will be returned.
Example
oPointerSafe:=TS_PointerSafe{ oOwner, 10, _SIZEOF( _WinGUID ) }
FOR X:=1 UPTO 10
pGUID:=oPointerSafe:ItemPointer( X )
// Do something with the GUID-pointer
...
NEXT
Source
METHOD ItemPointer( dwItemIndex AS DWORD ) AS PTR PASCAL CLASS TS_PointerSafe
LOCAL pRetVal AS PTR
TSTrace Enter
IF SELF:_BytesPointer<>NULL_PTR .AND. SELF:_BytesAllocated ; ...
... <>0
IF Between( dwItemIndex, 1, SELF:_ItemCount )
pRetVal:=SELF:_BytesPointer+( SELF:_ItemSize ; ...
... *( dwItemIndex-1 ) )
ELSE
pRetVal:=NULL_PTR
END
ELSE
TSTrace Warning "!(SELF:_BytesPointer<>NULL_PTR .AND. SELF:_BytesAllocated<>0)"
pRetVal:=NULL_PTR
END