FeedLoad example for Visual Basic
Note: Works with Access 97, but not with Access 95.
This example uses StartFeedLoad, FeedLoad, and StopFeedLoad and loads a file through a buffer to simulate receiving a transmitted image.
Private Sub FeedLoad_Click()
Dim RasterIO As New LEADRasterIO
' Declare a buffer that you will use to feed the file-load process.
Const BUFFERSIZE = 1000
Dim RasterVar As New LEADRasterVariant
RasterVar.Type = VALUE_STRING
' Declare other local variables.
Dim BytesRead As Long
Dim FileLength As Long
' Open an image file and get its length.
Open "d:\temp\24bit.bmp" For Binary Access Read As #1
FileLength = LOF(1)
' Set PaintWhileLoad so that we can watch the progress.
LEADRasterView1.PaintWhileLoad = True
' Initialize the file-load process.
' Specify the default bits per pixel and first page
If RasterIO.StartFeedLoad(LEADRasterView1.Raster, 0, 0, 1) <> 0 Then
MsgBox ("Error in StartFeedLoad !")
GoTo quit_function
End If
' Use FeedLoad in a loop to load the file into the bitmap.
Do
RasterVar.StringValue = Input(BUFFERSIZE, #1)
If FileLength > BUFFERSIZE Then
BytesRead = BUFFERSIZE
Else
BytesRead = FileLength
End If
FileLength = FileLength - BytesRead
If RasterIO.FeedLoad(RasterVar, BytesRead) <> 0 Then
MsgBox ("Error in FeedLoad !")
GoTo quit_function
End If
Loop Until FileLength <= 0
' Finish the file-load process.
If RasterIO.StopFeedLoad() <> 0 Then
MsgBox ("Error in StopFeedLoad !")
GoTo quit_function
End If
quit_function:
' Close the file.
Close #1
End Sub