News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GDI Plus and Masm32 difference

Started by Grincheux, January 25, 2009, 08:25:36 PM

Previous topic - Next topic

Grincheux

In the function listed bellow I use GDI Plus for loading images and if GDI Plus can't load the image I use the function found in Masm32 library.
I don't understand why GDI+ can't load an image and others functions can ?

What is the difference ?
I noticed that GDI Plus returned ther error code number #3. Which means a memory error ! (GDIP_ERR_OutOfMemory)

; ================================================================================

Image_LoadFromFile PROC __lpszImageFileName:LPSTR
LOCAL _szWideChar[2 * MAX_PATH]:Byte
LOCAL _hBitmap:HBITMAP
LOCAL _SrcImage:DWord

lea edx,_szWideChar

INVOKE MultiByteToWideChar,CP_OEMCP,MB_PRECOMPOSED,__lpszImageFileName,-1,edx,2 * MAX_PATH

lea eax,_SrcImage
lea edx,_szWideChar

INVOKE GdipLoadImageFromFileICM,edx,eax

test eax,eax
jnz @Error_1

lea edx,_hBitmap
mov DWord Ptr [edx],eax

INVOKE GdipCreateHBITMAPFromBitmap,_SrcImage,edx,0

test eax,eax
jnz @Error

INVOKE GdipDisposeImage,_SrcImage

mov eax,_hBitmap

leave
retn 4

@Error :

INVOKE GdipDisposeImage,_SrcImage

@Error_1 :

INVOKE BitmapFromFile,__lpszImageFileName

test eax,eax
jz @Exit

leave
retn 4

@Exit :

ret
Image_LoadFromFile ENDP

; ================================================================================

Thanks for some help !

Kenavo

Grincheux
_____________________________________________________
http://www.phrio.biz