Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: VB4/32,VB5,VB6
Expertise: Intermediate
Apr 7, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning

GetBitmapInfo - Retrieve width, height and colors in a bitmap

    bmType As Long
    bmWidth As Long
    bmHeight As Long
    bmWidthBytes As Long
    bmPlanes As Integer
    bmBitsPixel As Integer
    bmBits As Long
End Type
Private Declare Function GetObjectAPI Lib "gdi32" Alias "GetObjectA" (ByVal _
    hObject As Long, ByVal nCount As Long, lpObject As Any) As Long

' Returns info on a bitmap loaded into a picture
' Pass the Picture property in the first argument
' Find the results in the remaining arguments

Sub GetBitmapInfo(ByVal handle As Long, width As Integer, height As Integer, _
    Optional colorPlanes As Integer, Optional bitsperpixel As Integer)
    Dim bmp As BITMAP
    ' call the API
    GetObjectAPI handle, Len(bmp), bmp
    ' return values throgh argumens
    width = bmp.bmWidth
    height = bmp.bmHeight
    colorPlanes = bmp.bmPlanes
    bitsperpixel = bmp.bmBitsPixel
End Sub

Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date