Hey Man,
I have alot of code here for you. I have been working on a BMP veiwer myself. I haven't been working on it lately because time is a little hard to find. What I have for you is a BMP header reader. It demonstrates how to use TYPEs for reading binary files. A TYPE makes it so much easier. I know that BMP.H is hard to read, I left the format info in comments.
'Save the following file as
'BMP.H
'Save it in your QB directory
'
TYPE BMPHEAD
'Offset Field Size Contents
identifier AS STRING * 2
'0000h Identifier 2 bytes The characters identifying the bitmap.
'The following entries are possible: 'BM' - Windows 3.1x, 95, NT,
' 'BA' - OS/2 Bitmap Array 'CI' - OS/2 Color Icon
''CP' - OS/2 Color Pointer 'IC' - OS/2 Icon 'PT' - OS/2 Pointer
filesize AS LONG
'0002h File Size 1 dword Complete file size in bytes.
reserved AS LONG
'0006h Reserved 1 dword Reserved for later use.
dataoffset AS LONG
'000Ah Bitmap Data Offset 1 dword Offset from beginning of file to the
'beginning of the bitmap data.
headersize AS LONG
'000Eh Bitmap Header Size 1 dword Length of the Bitmap Info Header
'used to describe the bitmap colors, compression, The following
'sizes are possible: 28h - Windows 3.1x, 95, NT,
'_ 0Ch - OS/2 1.x F0h - OS/2 2.x
lwidth AS LONG
'0012h Width 1 dword Horizontal width of bitmap in pixels.
lheight AS LONG
'0016h Height 1 dword Vertical height of bitmap in pixels.
planes AS INTEGER
'001Ah Planes 1 word Number of planes in this bitmap.
bitsperpixel AS INTEGER
'001Ch Bits Per Pixel 1 word Bits per pixel used to store palette entry
'information. This also identifies in an indirect way the number of
'possible colors. Possible values are: 1 - Monochrome bitmap
'4 - 16 color bitmap 8 - 256 color bitmap
'16 - 16bit (high color) bitmap 24 - 24bit (true color) bitmap
'32 - 32bit (true color) bitmap
compression AS LONG
'001Eh Compression 1 dword Compression specifications.
'The following values are possible:
'0 - none (Also identified by BI_RGB)
'1 - RLE 8-bit / pixel (Also identified by BI_RLE4)
'2 - RLE 4-bit / pixel (Also identified by BI_RLE8)
'3 - Bitfields (Also identified by BI_BITFIELDS)
datasize AS LONG
'0022h Bitmap Data Size 1 dword Size of the bitmap data in bytes.
'This number must be rounded to the next 4 byte boundary.
hresolution AS LONG
'0026h HResolution 1 dword Horizontal resolution expressed in
'pixel per meter.
vresolution AS LONG
'002Ah VResolution 1 dword Vertical resolution expressed in
'pixels per meter.
colors AS LONG
'002Eh Colors 1 dword Number of colors used by this bitmap.
'For a 8-bit / pixel bitmap this will be 100h or 256.
important AS LONG
'0032h Important Colors 1 dword Number of important colors.
'This number will be equal to the number of colors when every
'color is important.
'0036h Palette N * 4 byte The palette specification.
'For every entry in the palette four bytes are used to describe the
'RGB values of the color in the following way:
'1 byte for blue component 1 byte for green component
'1 byte for red component 1 byte filler which is set to 0 (zero)
'0436h Bitmap Data x bytes Depending on the compression specifications,
'this field contains all the bitmap data bytes which represent
'indices in the color palette.
END TYPE
The next code is the main program--------------------------------
'Save this as BMPREAD.BAS
'
'all this does is read the BMP Header
'$INCLUDE: 'bmp.h'
DIM bmp1 AS BMPHEAD
OPEN COMMAND$ FOR BINARY AS #1
GET #1, , bmp1
CLOSE #1
PRINT "Identifier: "; bmp1.identifier
PRINT "File size:"; bmp1.filesize
PRINT "Reserved:"; bmp1.reserved
PRINT "Offset of bitmap data:"; bmp1.dataoffset
PRINT "Size of header:"; bmp1.headersize
PRINT "Length of image:"; bmp1.lwidth
PRINT "Height of image:"; bmp1.lheight
PRINT "Planes:"; bmp1.planes
PRINT "Bits per pixel:"; bmp1.bitsperpixel
PRINT "Compression:"; bmp1.compression
PRINT "Size of bitmap data:"; bmp1.datasize
PRINT "Horizontal resolution:"; bmp1.hresolution; "pixels per meter"
PRINT "Vertical resolution:"; bmp1.vresolution; "pixels per meter"
PRINT "Number of colors:"; bmp1.colors
PRINT "Number of important colors:"; bmp1.important
PRINT
END