NumGet

Returns the binary number stored at the specified address+offset.

Number := NumGet(Source, Offset, Type)
Number := NumGet(Source, Type)

Parameters

Source

Type: Object or Integer

A Buffer-like object or memory address.

Any object which implements Ptr and Size properties may be used, but this function is optimized for the native Buffer object. Passing an object with these properties ensures that the function does not read memory from an invalid location; doing so could cause crashes or other unpredictable behaviour.

Offset

Type: Integer

If blank or omitted (or when using 2-parameter mode), it defaults to 0. Otherwise, specify an offset in bytes which is added to Source to determine the source address.

Type

Type: String

One of the following strings: UInt, Int, Int64, Short, UShort, Char, UChar, Double, Float, Ptr or UPtr

Unsigned 64-bit integers are not supported, as AutoHotkey's native integer type is Int64. Therefore, to work with numbers greater than or equal to 0x8000000000000000, omit the U prefix and interpret any negative values as large integers. For example, a value of -1 as an Int64 is really 0xFFFFFFFFFFFFFFFF if it is intended to be a UInt64. On 64-bit builds, UPtr is equivalent to Int64.

For details see DllCall Types.

Return Value

Type: Integer or Float

This function returns the binary number at the specified address+offset.

General Remarks

If only two parameters are present, the second parameter must be Type. For example, NumGet(var, "int") is valid.

An exception may be thrown if the source address is invalid. However, some invalid addresses cannot be detected as such and may cause unpredictable behaviour. Passing a Buffer object instead of an address ensures that the source address can always be validated.

NumPut, DllCall, Buffer object, VarSetStrCapacity