Home > Language Reference > Classes > StreamMemory
Map Method
Maps the StreamMemory object to a specific memory address.
Syntax
Public Sub Map(ByVal lStartAddr As Long, Optional ByVal lSize As Long = -1)
| Parameter | Description |
| lStartAddr | Starting address. |
| lSize | Optional size. |
Remarks
The Map method maps the StreamMemory object to the memory block whose address and size are specified by the lStartAddr and lSize parameters. If the object previously allocated a memory block, it is freed. This method does not perform parameter validation. It is up to the programmer to ensure the memory lStartAddr points to correspond to a valid chunk.
After this method is called, the Kind property returns hbStreamMapped.
This method is typically used to manage pointers, whether they are returned by an external C function or by a predefined HB++ function. The following example uses a memory mapped StreamMemory object to access bitmap bits:
Private Sub Button1_Click()
Dim bm As New Bitmap
Dim s As New StreamMemory
Dim x As Integer, y As Integer
bm.Create 80,50,8,hbDensityLow
s.Map bm.Bits, 80*50
For y=0 To 49
For x=0 To 79
s.Write CByte(x)
Next x
Next y
CopyArea 0,20,80,50,bm,0,0
End SubFor further information on shared libraries and communication between HB++ and the C language, refer to the Shared library chapter in the Programmer's Guide and the description of the Declare statement.
System requirements
| System | Minimal version | Remarks |
| Palm OS | Palm OS 3.0 | N/A |