If you don't want to load the picture into a picturebox, you can use the following code:
vb Code:
Option Explicit Private Type BITMAPFILEHEADER bfType(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 Private Sub GetBitmapSize(ByVal Bitmap As String, ByRef lWidth As Long, ByRef lHeight As Long) Dim hFile As Integer Dim bfh As BITMAPFILEHEADER Dim bih As BITMAPINFOHEADER hFile = FreeFile Open Bitmap For Binary Access Read Shared As #hFile Get #hFile, , bfh Get #hFile, , bih Close #hFile lWidth = bih.biWidth lHeight = bih.biHeight End Sub Private Sub Command1_Click() Dim lngWidth As Long Dim lngHeight As Long Call GetBitmapSize("c:\windows\zapotec.bmp", lngWidth, lngHeight) MsgBox "Width: " & lngWidth & vbCrLf & "Height: " & lngHeight End Sub




