ReadFileCommentOffset Example for Visual Basic
' The following sample will create a file with an offset and will read a comment from the file it just saved:
Public RasterIO As New LEADRasterIO
Public Raster As New LEADRaster
Public RasterVar As New LEADRasterVariant
Private Sub TestReadFileCommentOffset()
Dim nRet As Integer
' Load an existing bitmap
nRet = RasterIO.Load(Raster, "eagle.cmp", 0, 1, -1)
If nRet <> 0 Then
MsgBox "Load has failed!"
Exit Sub
End If
RasterVar.Type = VALUE_STRING
RasterVar.StringValue = "This is a 29-character string"
' set and save a comment into a file with an offset
Set RasterIO.Comment(CMNT_SZARTIST) = RasterVar
' Save the image file with an offset inside the TOFFSET.TST file
nRet = RasterIO.SaveOffset(Raster, "eagle.cmp", 30, FILE_TIF, 1, QFACTOR_LEAD_0, SAVE_OVERWRITE)
' free the bitmap
Raster.Free
' Notify the user with a message box
If nRet <> 0 Then
MsgBox "Error saving file"
Exit Sub
End If
' ***** Now load the file we just saved ****
' Get the comment size
nRet = RasterIO.ReadFileCommentOffset("eagle.cmp", 30, RasterIO.FileSizeWritten, CMNT_SZARTIST, RasterVar)
MsgBox RasterVar.StringValue
End Sub