请问如何使用二进制读取BMP文件的头文件的信息?
附BMP类型的定义:
Private Type BITMAP '14 bytes
        bmType As Long
        bmWidth As Long
        bmHeight As Long
        bmWidthBytes As Long
        bmPlanes As Integer
        bmBitsPixel As Integer
        bmBits As Long
End Type
Private Type BITMAPINFOHEADER '40 bytes
    biSize As Long
    biWidth As Long
    biHeight As Long
    biPlanes As Integer
    biBitCount As Integer
    biCompression As Long
    biSizeImage As Long
    biXPelsPerMeter As Long
    biYPelsPerMeter As Long
    biClrUsed As Long
    biClrImportant As Long
End Type
Private Type RGBQUAD
    rgbBlue As Byte
    rgbGreen As Byte
    rgbRed As Byte
    rgbReserved As Byte
End Type
Private Type BITMAPINFO
    bmiHeader As BITMAPINFOHEADER
    bmiColors(0 To &HFF) As RGBQUAD
End Type

解决方案 »

  1.   

    Private   Type   BITMAPFILEHEADER
                    bfType(0   To   1)   As   Byte
                    bfSize   As   Long
                    bfReserved1   As   Integer
                    bfReserved2   As   Integer
                    bfOffBits   As   Long
    End   Type
    Private   Type   BITMAPINFOHEADER
                    biSize   As   Long
                    biWidth   As   Long
                    biHeight   As   Long
                    biPlanes   As   Integer
                    biBitCount   As   Integer
                    biCompression   As   Long
                    biSizeImage   As   Long
                    biXPelsPerMeter   As   Long
                    biYPelsPerMeter   As   Long
                    biClrUsed   As   Long
                    biClrImportant   As   Long
    End   Type
    ........
    Dim   bmfh   As   BITMAPFILEHEADER
    Dim   bmih   As   BITMAPINFOHEADER
    open "你的bmp文件路径" for binary as #1
    get #1,,bmfh
    get #1,,bmih
    close #1
      

  2.   

    谢谢啊!
    不过,这种格式定义是C++中的吧?
    不是VB “API 文本浏览器”中的定义吧?
    有没有针对“API 文本浏览器”中的定义实现的代码呢?
      

  3.   

    //不过,这种格式定义是C++中的吧?
    不是VB “API 文本浏览器”中的定义吧?这个和vc或vb没什么关系,这是根据bmp的文件格式定义的