Click or drag to resize

MemWord Function

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

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

Parameters

ptrBuffer
Type: IntPtr
A pointer to the memory buffer to examine.
dwValue
Type: Word
The word value to match.
dwCount
Type: DWord
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#
1Function Start()
2    LOCAL ptrW := "ABCDEFGHIJ" AS PSZ
3    ? MemWord(ptrW, Bin2W("CD"), 3)    // A pointer
4    ? MemWord(ptrW, Bin2W("CD"), 1)
5    // Not found in the first word of ptrW
6    //   0000:0000
See Also