Click or drag to resize

MemWord Function

Get a pointer to a matching word in a memory buffer.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.10
Syntax
 FUNCTION MemWord(
	ptrBuffer AS IntPtr,
	dwValue AS WORD,
	dwCount AS DWORD
) AS IntPtr
View Source

Parameters

ptrBuffer
Type: IntPtr
A pointer to the memory buffer to examine.
dwValue
Type: UInt16
The word value to match.
dwCount
Type: UInt32
The number of words in <ptrBuffer> to examine.

Return Value

Type: IntPtr
A pointer to the first occurrence of <dwValue> within the first <dwCount> words of <ptrBuffer>.  If <dwValue> is not matched, MemWord() returns a NULL_PTR.
Remarks
Examples
This example uses MemWord() on a PSZ:
X#
Function Start()
        LOCAL ptrW := "ABCDEFGHIJ" AS PSZ
        ? MemWord(ptrW, Bin2W("CD"), 3)        // A pointer
        ? MemWord(ptrW, Bin2W("CD"), 1)
        // Not found in the first word of ptrW
        //   0000:0000
See Also