Hi,
I'm writing an app that strips .tif images from a file that contains a concatination of tifs, and then displays them, but I'm running into some problems regarding access errors. Here's the code that strips the .tif and displays it:
Dim arImage() As Byte
Dim ff As Integer
ff = FreeFile
ReDim arImage(imgSize)
Open fimFile For Binary As #ff
Get #ff, imgPoint, arImage
Close #ff
ff = FreeFile
Open "tmp.tif" For Binary As #ff
Put #ff, , arImage
Close #ff
tifIDX.FileName = "tmp.tif"
imgPoint - long, pointer in fimFile of start of .tif
imgSize - long, size in bytes of .tif
tifIDX - MiDocView (Microsoft Office Document Viewer)
The first time I call the routine, it displays the stripped .tif in my MiDocView (tifIDX). But any subsequent call after that gives me a file/path access error at "put #ff, , arImage". I don't get it because I've closed the files each time through, and I've checked the MiDocView.Filename at the start of the routine, and it is always = "" to start, so I don't think the MiDocView is still holding the file.
This code will only work once, and then I actually have to close the project to run it again.
Any ideas?
I'm writing an app that strips .tif images from a file that contains a concatination of tifs, and then displays them, but I'm running into some problems regarding access errors. Here's the code that strips the .tif and displays it:
Dim arImage() As Byte
Dim ff As Integer
ff = FreeFile
ReDim arImage(imgSize)
Open fimFile For Binary As #ff
Get #ff, imgPoint, arImage
Close #ff
ff = FreeFile
Open "tmp.tif" For Binary As #ff
Put #ff, , arImage
Close #ff
tifIDX.FileName = "tmp.tif"
imgPoint - long, pointer in fimFile of start of .tif
imgSize - long, size in bytes of .tif
tifIDX - MiDocView (Microsoft Office Document Viewer)
The first time I call the routine, it displays the stripped .tif in my MiDocView (tifIDX). But any subsequent call after that gives me a file/path access error at "put #ff, , arImage". I don't get it because I've closed the files each time through, and I've checked the MiDocView.Filename at the start of the routine, and it is always = "" to start, so I don't think the MiDocView is still holding the file.
This code will only work once, and then I actually have to close the project to run it again.
Any ideas?