DeRefW
See Also: Memory Management Functions
Purpose
Retrieves the contents of one word (two bytes) of memory using a Pointer to its memory address.
Syntax
DeRefW({pMemory}, {iOffset})
Parameters
- {pMemory}: A Pointer variable that is set equal to the block of memory.
- {iOffset}: An integer variable that contains the offset within the block of memory where the reading will take place.
Return Type
Returns an Integer signifying the variant type in the memory address. These can be any of the following:
- OLE_VT_Empty: 0 // Empty (Nothing)
- OLE_VT_Null: 1 // Null (Not used)
- OLE_VT_I2: 2 // 2-byte signed int (Short data type)
- OLE_VT_I4: 3 // 4-byte signed int (Integer data type)
- OLE_VT_R4: 4 // 4-byte real (Float data type)
- OLE_VT_R8: 5 // 8-byte real (Real data type)
- OLE_VT_Cy: 6 // Currency (Currency data type)
- OLE_VT_Date: 7 // DateTime (DateTime data type)
- OLE_VT_Bstr: 8 // Binary string (String data type)
- OLE_VT_Dispatch: 9 // IDispatch FAR* (LPDispatch data type)
- OLE_VT_Error: 10 // SCODE (OLEError data type)
- OLE_VT_Bool: 11 // Boolean (Boolean data type)
- OLE_VT_Variant: 12 // VARIANT (Variant data type)
- OLE_VT_Unknown: 13 // IUnknown FAR* (LPIUnknown data type)
- OLE_VT_Decimal: 14 // Decimal (Decimal data type)
- OLE_VT_I1: 16 // Signed char (Char data type)
- OLE_VT_Ui1: 17 // Unsigned char (UChar data type)
- OLE_VT_Ui2: 18 // 2-byte unsigned int (UShort data type)
- OLE_VT_Ui4: 19 // 4-byte unsigned int (UInteger data type)
- OLE_VT_I8: 20 // 8-byte signed int (BigInt data type)
- OLE_VT_UI8: 21 // 8-byte unsigned int (UBigInt data type)
- OLE_VT_INT_PTR: 20 (64-bit) // 8-byte signed int, maps to OLE_VT_I8 (BigInt data type)
- OLE_VT_UINT_PTR: 21 (64-bit) // 8-byte unsigned int, maps to OLE_VT_UI8 (UBigInt data type)
- OLE_VT_INT_PTR: 3 (32-bit) // 4-byte signed int, maps to OLE_VT_I4 (Integer data type)
- OLE_VT_UINT_PTR: 19 (32-bit) // 4-byte unsigned int, maps to OLE_VT_UI8 (UInteger data type)
- OLE_VT_Void: 24 // Void
- OLE_VT_Hresult: 25 // HRESULT (Integer data type)
- OLE_VT_Record: 36 // User defined type (Struct type)
- OLE_VT_Array: |CI$2000
- OLE_VT_BYREF: |CI$4000
What It Does
Retrieves the contents of one word of a memory block using a pointer to its memory address and a given offset.
Example
Function GetMemoryWord Pointer aPointer Integer iOffset Returns Integer
Integer iWordValue
Move (DeRefW(aPointer, iOffset)) to iWordValue
Function_Return iWordValue
End_Function
Notes
- Using the DeRefW function with invalid parameters will likely cause your program to crash.