Click or drag to resize

MemShort Function

X#
Get a pointer to a matching short integer in a memory buffer.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION MemShort(
	ptrBuffer AS IntPtr,
	siValue AS SHORT,
	dwCount AS DWORD
) AS IntPtr
Request Example View Source

Parameters

ptrBuffer
Type: IntPtr
A pointer to the memory buffer to examine.
siValue
Type: Short
The short integer value to match.
dwCount
Type: DWord
The number of short integers in ptrBuffer to examine.

Return Value

Type: IntPtr
A pointer to the first occurrence of siValue within the first dwCount short integers of ptrBuffer.
If siValue is not matched, MemShort() returns a NULL_PTR.
Remarks
Examples
This example uses MemShort() on a PSZ:
X#
1FUNCTION StartShort()
2    LOCAL ptrSI := "ABCDEFGHIJ" AS PSZ
3    // Note: short integer translation of "AB"
4    // is 16961
5    ? MemShort(ptrSI, 16961,2)         // A pointer
6    ? MemShort(ptrSI, 16961,1)         // A pointer
7    // Same pointer as above
See Also