Peek Functions

Purpose

Reads a value with the specified data type from an address.

Syntax

Byte = Peek(addr)

Card = CPeek(addr)

Currency = CurPeek(addr)

Short = DPeek(addr)

Double = DblPeek(addr)

Long = LPeek(addr)

Large = Peek8(addr)

Single = SngPeek(addr)

String = Peek$( addr, len)

String = StrPeek(addr, len)

String = CharPeek(addr)

addr : address
len : length of required string

Example

Debug.Show

Local a$ = "1234567890123456" & Chr(0)

Local d As Double = 12345678.90, s As Single = 12345.67

Trace Hex(Peek(V:a$))

Trace Hex(CPeek(V:a$))

Trace Hex(CurPeek(V:a$))

Trace Hex(DPeek(V:a$))

Trace Hex(DblPeek(V:a$)) // Returns 0

Trace DblPeek(V:d)

Trace Hex(LPeek(V:a$))

Trace Hex(Peek8(V:a$))

Trace Hex(SngPeek(V:a$)) // Returns 0

Trace SngPeek(V:s)

Trace Peek$(V:a$, Len(a$))

Trace StrPeek(V:a$, Len(a$))

Trace CharPeek(V:a$)

Remarks

The Peek functions have corresponding {} functions and they can be used instead.

CharPeek, like Char{}, is most useful when used with API functions as it reads a string from an address until the next zero byte.

OpenW 1

Print title(Win_1.hWnd)

Do : Sleep : Until Me Is Nothing

 

Function title(ByVal f As Handle) As String

Local s As String*256

~GetWindowText(f, V:s, SizeOf(s))

Return CharPeek(V:s)

EndFunc

See Also

xx{}

{Created by Sjouke Hamstra; Last updated: 21/10/2014 by James Gaite}