Older Version Newer Version

Alyce Alyce Jan 7, 2006

[[code]]


Get Bitmap Dimensions

    struct BITMAP,_ 
    bmType as long,_
    bmWidth As long,_
    bmHeight As long,_
    bmWidthBytes As long,_
    bmPlanes as word,_
    bmBitsPixel as word,_
    bmBits as Long

filedialog "Open","*.bmp",bmp$
if bmp$="" then end
loadbmp "testbmp",bmp$
hTest=hbmp("testbmp")
print BitmapWidth(hTest)
print BitmapHeight(hTest)
unloadbmp "testbmp"
END

Function BitmapWidth(hBmp)
    length=len(BITMAP.struct)
    calldll #gdi32, "GetObjectA", hBmp as ulong,_
       length as long,BITMAP as struct,_
       results as long
    BitmapWidth=BITMAP.bmWidth.struct
End Function

Function BitmapHeight(hBmp)
    length=len(BITMAP.struct)
    calldll #gdi32, "GetObjectA", hBmp as ulong,_
       length as long,BITMAP as struct,_
       results as long
    BitmapHeight=BITMAP.bmHeight.struct
End Function
[[code]]

----

[[user:Alyce|1136644879]]