GetFileInfo example for Visual Basic
Note: Also works with Access 95 and 97.
This example gets information about the specified file.
' Declare local variables
Dim fname, pg, fmt, LeadWidth, LeadHeight, bps, xres, yres, sizd, sizm, cmp, cFmt, cMsg, answer
Dim RasterIO As New LEADRasterIO
' Initialize variables
fname = "d:\temp\24bit.bmp"
pg = 0
' Update the variables
RasterIO.GetFileInfo LEADRasterView1.Raster, fname, pg, FILEINFO_TOTALPAGES
' Read the updated properties
fmt = RasterIO.InfoFormat
LeadWidth = RasterIO.InfoWidth
LeadHeight = RasterIO.InfoHeight
bps = RasterIO.InfoBits
pg = RasterIO.InfoPage
sizd = RasterIO.InfoSizeDisk
sizm = RasterIO.InfoSizeMem
cmp = RasterIO.InfoCompress
' Translate the meaning of the format constant
Select Case fmt
Case FILE_PCX
cFmt = "ZSoft PCX"
Case FILE_GIF
cFmt = "CompuServe GIF"
Case FILE_TGA
cFmt = "TARGA"
Case FILE_PNG
cFmt = "Portable Network Graphics"
Case FILE_PSD
cFmt = "Adobe Photoshop 3.0"
Case FILE_BMP
cFmt = "Windows BMP"
Case FILE_OS2
cFmt = "OS/2 BMP version 1.x"
Case FILE_OS2_2
cFmt = "OS/2 BMP version 2.x"
Case FILE_WMF
cFmt = "Windows Meta File"
Case FILE_EPS
cFmt = "Encapsulated PostScript"
Case FILE_MAC
cFmt = "MacPaint"
Case FILE_PCT
cFmt = "Macintosh Pict"
Case FILE_MSP
cFmt = "Microsoft Paint"
Case FILE_IMG
cFmt = "GEM Image"
Case FILE_PCD
cFmt = "Kodak PhotoCD"
Case FILE_EPSTIFF
cFmt = "Encapsulated PostScript with an embedded TIFF file"
Case Else
cFmt = "Unknown format"
End Select
' Create the message string
cMsg = fname + Chr(13) + "Page = " + Str(pg) + " of " + CStr(RasterIO.InfoTotalPages) + Chr(13) + "Format = " + cFmt + Chr(13)
cMsg = cMsg + "Width = " + Str(LeadWidth) + Chr(13) + "Height = " + Str(LeadHeight) + Chr(13)
cMsg = cMsg + "Size in memory = " + Str(sizm) + Chr(13) + "Size on disk = " + Str(sizd) + Chr(13)
cMsg = cMsg + "Bits per pixel = " + Str(bps) + Chr(13)
cMsg = cMsg + "X resolution = " + Str(xres) + Chr(13) + "Y resolution = " + Str(yres)
' Display the message box
MsgBox cMsg, 0, "File Info"