flat assembler
Message board for the users of flat assembler.
Index
> Windows > Why CreateDIBSection() returns NULL? |
Author |
|
Lion17 19 Jun 2006, 11:46
replace code
Code: infoheader BITMAPINFOHEADER 40,581,381,1,24,BI_RGB,0,0,0,0,0 bminfo BITMAPINFO with Code: bminfo: infoheader BITMAPINFOHEADER 40,581,381,1,24,BI_RGB,0,0,0,0,0 delete code Code: mov eax,[infoheader] mov [bminfo.bmiHeader],eax |
|||
19 Jun 2006, 11:46 |
|
programmer 19 Jun 2006, 11:59
Thanks!
I'm trying to save bitmap from DC to file, but it doesn't work anyway. Please help me. Code: fileheader BITMAPFILEHEADER 0x4D42,0,0,0,54 bminfo: infoheader BITMAPINFOHEADER 40,581,381,1,24,BI_RGB,0,0,0,0,0 ;bminfo BITMAPINFO nobw dd ? winDC dd ? memDC dd ? hbitmap dd ? bmsize dd ? hfile dd ? bmbits dd ? proc SaveBitmapToFile ;mov eax,[infoheader] ;mov [bminfo.bmiHeader],eax invoke GetWindowDC,[hPicDisp] mov [winDC],eax invoke CreateCompatibleDC,[winDC] mov [memDC],eax invoke CreateDIBSection,[winDC],bminfo,0,bmbits,0,0 mov [hbitmap],eax invoke SelectObject,[memDC],[hbitmap] invoke BitBlt,[memDC],0,0,581,381,[winDC],0,0,SRCCOPY invoke DeleteDC,[memDC] invoke ReleaseDC,[hPicDisp],[winDC] invoke CreateFile,'C:\screen.bmp',GENERIC_READ + GENERIC_WRITE,0,0,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0 mov [hfile],eax invoke WriteFile,[hfile],fileheader,14,nobw,0 invoke WriteFile,[hfile],infoheader,40,nobw,0 ;((biWidth * (biBitCount / 8) + 3) And &HFFFFFFFC) * biHeight mov eax,24 ;mov ebx,8 ;div ebx shr eax,3 mov ebx,[infoheader.biWidth] mul ebx add eax,3 and eax,0xFFFFFFFC mov ebx,[infoheader.biHeight] mul ebx invoke WriteFile,[hfile],bmbits,eax,nobw,0 invoke CloseHandle,[hfile] invoke DeleteObject,[hbitmap] ret endp |
|||
19 Jun 2006, 11:59 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.