I am trying to create a bitmap on the fly. The error that is returned is about a wrong parameter. I think I might be messing something up with either the BITMAPINFO struct or the arrays. The only examples I could find were the screen capturing function, but it confuses me by calling the function with parameters in a different order. I am going by win32 ref and it appears to me that everything is how it should be.

.data
bData db 2,1,2,2,2,2,2,2,2,1,2
db 2,2,1,2,2,2,2,2,1,2,2
db 2,2,2,1,2,2,2,1,2,2,2
db 2,2,2,2,1,2,1,2,2,2,2
db 2,2,2,2,2,1,2,2,2,2,2
db 2,2,2,2,2,2,2,2,2,2,2

; #########################################################################
MakeArrow proc
LOCAL bheader :BITMAPINFOHEADER
LOCAL bInfo :BITMAPINFO
LOCAL hBitmap1 :HBITMAP
LOCAL bColor[5] :RGBQUAD
LOCAL mDC :DWORD

invoke CreateCompatibleDC,NULL
mov mDC,eax


mov bColor[0],0FF000000h
mov bColor[1*4],000FF0000h
mov bColor[2*4],00000FF00h
mov bColor[3*4],0ffffff00h
mov bColor[4*4],0ffffff00h


mov bheader.biSize, sizeof BITMAPINFOHEADER
mov bheader.biWidth, 11
mov bheader.biHeight, 6
mov bheader.biPlanes, 1
mov bheader.biBitCount, 4
mov bheader.biCompression, BI_RGB
mov bheader.biSizeImage, 0
mov bheader.biXPelsPerMeter,0
mov bheader.biYPelsPerMeter,0
mov bheader.biClrUsed, 5
mov bheader.biClrImportant, 0

m2m bInfo.bmiHeader, bheader
m2m bInfo.bmiColors, bColor

invoke CreateDIBitmap,hDC,ADDR bheader,CBM_INIT,ADDR bData,ADDR bInfo,DIB_RGB_COLORS
PrintError
mov hBitmap1,eax

invoke SelectObject,mDC,hBitmap1
invoke StretchBlt, hDC,10,10,55,30,mDC,0,0,11,6,SRCCOPY ;Copy dib to hDC
ret

MakeArrow endp
; #########################################################################

let me know what you think
Posted on 2002-03-14 18:39:59 by CsnWltr