Available in the LEADTOOLS Imaging toolkit. |
Comment example for Access 2.0
This example does the following:
1. Loads an image from a TIFF file.
2. Updates and modifies one of the comments.
3. Modifies and saves the file.
4. Reads the comment that was saved, and displays it in a message box.
Note: Access 2.0 produces an untrappable error if you try to read a comment that does not exist in a file. This problem does not occur with later versions of Access.
Dim MyCommentText As String 'For the comment string that we add
Dim NewCommentText As String 'For the CMNT_SZDESC comment that we read
Dim TmpVariant As Variant 'For holding the current CMNT_SZDESC comment
Dim FilePath As String 'File to be updated
'Specify the file that we will update.
FilePath = "c:\lead\images\testcmt.tif"
'Clear the current CMNT_SZDESC comment.
Me![Lead1].Object.Comment(CMNT_SZDESC) = Empty
'Load and modify the image.
Me![Lead1].Object.Load FilePath, 0, 0, 1
Me![Lead1].Object.Reverse
'Update the CMNT_SZDESC comment.
TmpVariant = Me![Lead1].Object.ReadComment(FilePath, 0, CMNT_SZDESC)
MyCommentText = Chr(13) + "This image has been reversed."
Me![Lead1].Object.Comment(CMNT_SZDESC) = TmpVariant + MyCommentText
'Save the file.
Me![Lead1].Object.Save FilePath, FILE_TIF, Me![Lead1].Object.BitmapBits, 0, SAVE_OVERWRITE
'Read the comment that we saved.
NewCommentText = Me![Lead1].Object.ReadComment(FilePath, 0, CMNT_SZDESC)
'Display the message
MsgBox NewCommentText
'Clear the comment from memory
Me![Lead1].Object.Comment(CMNT_SZDESC) = Empty