Option Explicit
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 Private Type BITMAPFILEHEADER bfType As Integer bfSize As Long bfReserved1 As Integer bfReserved2 As Integer bfOffBits As Long End Type Public Type BITMAPINFO Width As Long Height As Long End Type Public Function GetBMPInfo(psPath As String) As BITMAPINFO Dim f As Integer Dim tmp As String Dim FileHeader As BITMAPFILEHEADER Dim InfoHeader As BITMAPINFOHEADER Dim i As BITMAPINFO On Error Resume Next f = FreeFile Open psPath For Binary Access Read As #f Get #f, , FileHeader Get #f, , InfoHeader Close #f i.Width = InfoHeader.biWidth i.Height = InfoHeader.biHeight GetBMPInfo = i End Function |