Originally posted by Iain Johnstone:
[snip]
lpBITMAPINFOHEADER.biBitCount = 24
lpBITMAPINFOHEADER.biSizeImage = 54& + bm.bmWidthBytes * bm.bmHeight
f = FREEFILE
OPEN FileBmp FOR OUTPUT AS #f
PRINT #f, lpBITMAPFILEHEADER lpBITMAPINFOHEADER _
PEEK$(bm.bmBits, bm.bmWidthBytes * bm.bmHeight);
CLOSE #f
'================
I cannot see why NT has a problem with this - any suggestions?
Iain
[snip]
lpBITMAPINFOHEADER.biBitCount = 24
lpBITMAPINFOHEADER.biSizeImage = 54& + bm.bmWidthBytes * bm.bmHeight
f = FREEFILE
OPEN FileBmp FOR OUTPUT AS #f
PRINT #f, lpBITMAPFILEHEADER lpBITMAPINFOHEADER _
PEEK$(bm.bmBits, bm.bmWidthBytes * bm.bmHeight);
CLOSE #f
'================
I cannot see why NT has a problem with this - any suggestions?
Iain
tBI.bmiHeader.biSizeImage = pic.lStride * tBI.bmiHeader.biHeight
for 24 bits calculate stride (sometimes called pitch?) like this:
pic.lStride = ( bm.bmWidth * 3 + 3 ) And &HFFFFFFFC
Also do this when saving.
You also might want to try this function:
I noticed that some NT's can't load RLE compressed bmps.
Code:
Function bmpIsvalidAndNotCompressed(fname As String) As Long Local f As Long Local bmpheader As Asciiz*54 Local compType As Dword Ptr If IsFalse Exist(fname) Then Function=%False :Exit Function f=FreeFile Open fname For Binary As f If Lof(f)>=54 Then Get$ f,54,bmpheader Close f Else Close f msgbox fname & " is not a valid bmp file" Function=%False :Exit Function End If If UCase$(Left$(bmpheader,2))<>"BM" Then msgbox fname & " is not a valid bmp file" Function=%False :Exit Function End If compType=VarPtr(bmpheader)+30 If @compType<>0 Then msgbox fname & " is compressed" Function=%False :Exit Function End If Function=%true End Function
Best regards
Peter Scheutz
------------------
[This message has been edited by Peter Scheutz (edited December 20, 2000).]
Leave a comment: