EncodeABIC2 Example for Visual Basic
Private Declare Sub CopyMemory Lib "kernel32" Alias
"RtlMoveMemory" (ByRef Destination As Byte, ByVal Source As
Long, ByVal Length As Long)
Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem
As Long) As Long
Private Declare Function GlobalLock Lib "kernel32" (ByVal hMem
As Long) As Long
Private Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem
As Long) As Long
Private Sub EncodeAbic_Click()
Dim RasterIO As New LEADRasterIO
Dim hMem As Long, lSize As Long
Dim InputData As Variant
Dim OutputData As Variant
Dim BmpData() As Byte
Dim Data As Byte
Dim i As Integer
RasterIO.Load
LEADRasterView1.Raster, "c:\Abic.bmp", 0, 0, 1
RasterIO.SaveMemory2
LEADRasterView1.Raster, FILE_RAW,
0, 0, SAVE_OVERWRITE
If RasterIO.SaveMemory2Handle
<> 0 Then
Dim pMem As Long
pMem = GlobalLock(RasterIO.SaveMemory2Handle)
ReDim BmpData(RasterIO.SaveMemory2Size)
As Byte
CopyMemory BmpData(0), pMem, RasterIO.SaveMemory2Size
- 1
GlobalUnlock RasterIO.SaveMemory2Handle
GlobalFree RasterIO.SaveMemory2Handle
End If
InputData = BmpData
RasterIO.EncodeABIC2
InputData, 4, 472, 221, OutputData, False
Open "c:\Image2Raw2.ica" For Binary Access
Write As #1
For i = 0 To UBound(OutputData) - LBound(OutputData)
- 1
Data = CByte(OutputData(i))
Put #1, , Data
Next i
Close #1
End Sub