Hey. I've been trying to get the dimension of a bitmap but although it doesn't return any error the _SIZE struct doesn't get fillled. Why the hell would that be? .elseif uMsg==WM_PAINT
invoke BeginPaint,hWnd,addr ps
invoke CreateCompatibleDC,ps.hdc
mov hBackDC,eax
invoke GetBitmapDimensionEx,hBmp,addr sz
invoke TextOut,ps.hdc,0,300,ustr$(sz.x),8
invoke SelectObject,hBackDC,hBmp
shr sz.x,1
shr sz.y,1
mov eax,ps.rcPaint.right
sub eax,ps.rcPaint.left
shr eax,1
sub eax,sz.x
mov ebx,ps.rcPaint.bottom
sub ebx,ps.rcPaint.top
shr ebx,1
sub ebx,sz.y
shl sz.x,1
shl sz.y,1
invoke BitBlt,ps.hdc,eax,ebx,32,32,hBackDC,0,0,SRCCOPY
invoke DeleteObject,hBmp
invoke DeleteDC,hBackDC
invoke EndPaint,hWnd,addr ps
QuoteThe GetBitmapDimensionEx function retrieves the dimensions of a compatible bitmap. The retrieved dimensions must have been set by the SetBitmapDimensionEx function.
if you didn't set, you'll get zero.
uses the gdiplus
invoke GdipCreateBitmapFromHBITMAP,hBitmap,0,addr @GpImage
invoke GdipGetImageWidth,@GpImage,addr @imgWidth
invoke GdipGetImageHeight,@GpImage,addr @imgHeight
Hi xandaz,
You can try the GetObject API function to retrieve the dimensions of a bitmap :
https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getobject
Thanks for the help six_L but it didnt work wither. thanks
I'm thinking GetDIBBIts will work.
GetObject worked fine. Thanks y'all