Getting the Dimensions of A Bitmap
For cbitmap objects we can use the getBitmap () function to determine the height and width of the bitmap.
// The variable bitmap is a cbitmap object
Bitmap BM;
Bitmap.getBitmap (& BM);
BMWIDTH = BM.BMWIDTH;
BMHEIGHT = BM.BMHEIGHT;
If you have a hbitmap, you can attach it to a cbitmap Object and use the method shown Above or you can use
// the variable hbmp is a hbitmap
Bitmap BM;
:: GetObject (HBMP, SIZEOF (BM), & BM);
BMWIDTH = BM.BMWIDTH;
BMHEIGHT = BM.BMHEIGHT;
For images in a bmp file, you can use Something Like
CFILE FILE;
// sbmpfilename is the bmp filename
IF (! file.open (sbmpfileename, cfile :: moderad))
Return;
BitmapfileHeader Bmfheader;
// read file header
IF (file.read ((lpstr) & bmfheader, sizeof (bmfheader))! = sizeof (bmfheader))
Return;
// File Type Should Be 'BM'
IF (BMFHeader.BfType! = ((Word) ('M' << 8) | 'B')) Return;
Bitmapinfoheader bmiheader;
IF (File.Read ((LPSTR) & bmiheader, sizeof (bmiheader))! = sizeof (bmiheader))
Return;
INT BMWIDTH = Bmiheader.biwidth;
Int bmheight = bmiheader.biheight;