News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Problems loading bitmap from resource

Started by xandaz, November 01, 2020, 11:44:49 PM

Previous topic - Next topic

xandaz

   Hey guys. It's me again. What does MAKEINTRESOURCE do? if the low order word contains the resource identifier and high order word is zero, eax=100 should work for LoadBitmap right? thandks in advance

TouEnMasm

MAKEINTRESOURCE is just a macro used by C who convert the  size of a ressource
Quote
#define MAKEINTRESOURCEA(i) ((LPSTR)((ULONG_PTR)((WORD)(i))))
HB=(HBITMAP)LoadImage(g_hInst, MAKEINTRESOURCE(resmonimage), IMAGE_BITMAP, 0, 0,
LoadImageA PROTO hInst:HINSTANCE ,aname:XMASM ,atype:DWORD ,acx:DWORD ,cy:DWORD ,fuLoad:DWORD
the aname parameter need a dword or a QWORD in 64,The MAKEINTRESOURCE will change the size of the ressource.
An asm compiler do that without Macro ,just pass the value of the ressource.



Fa is a musical note to play with CL

xandaz

    Sorry ToutEnMasm. I'm not clarified. I did it all manually. Old school works always.

jj2007

Quote from: xandaz on November 01, 2020, 11:44:49 PMif the low order word contains the resource identifier and high order word is zero, eax=100 should work for LoadBitmap right?

Yesss :thumbsup:

xandaz


Vortex

Hi xandaz,

You can have a look at Iczelion's Tutorial 25: Simple Bitmap :

http://www.interq.or.jp/chubu/r6/masm32/tute/tute025.html

It's about using the LoadBitmap API function.

xandaz


xandaz

    Still doesn't load the resource. I'm using ResEdit for the purpose. Still gives Resource not found. i checked with resource hacker and the bitmaps are in the executable module. i tried hex instead of decimal. thanks a lot anyway

xandaz

   Also doesnt result with resource name type string.

xandaz

   ok... it's working now. thanks guys... you're the best.

jj2007

Now please tell us what was the problem - we are a curious bunch :bgrin:

xandaz

    Not sure. It's working fine now the LoadBitmap function. The problem was with ImageList_xxxx functions. I am having trouble adding the bitmaps to the Image List. I've tried ImageList_Add, ImageList_AddMasked and ImageList_LoadImage. Always returns -1. Why would that be?

jj2007

No idea, but I remember it was tricky. I use this...

  mov eax, tbs.tbButtonSize
  .if !eax
        add eax, 24             ; adapt as needed
        mov tbs.tbButtonSize, eax
  .endif
  mov imgList, rv(ImageList_Create, eax, eax, ILC_MASK or ILC_COLOR24, maxfiles, 0)     ; inspired by deutsche Site
;
...
invoke ImageList_AddMasked, imgList, hBitmap, 0


... with success :cool:

xandaz


xandaz

   Still doesn't work. Check out the code please if you dont mind.
                invoke  ImageList_Create,32,32,ILC_COLOR24+ILC_MASK,9,0
                mov     hIml,eax
                mov     ecx,9
                mov     esi,101
                cld
loop_1:
                push    ecx
                invoke  LoadBitmap,hInstance,esi
                invoke  ImageList_AddMasked,hIml,eax,0
                inc     esi
                pop     ecx
                loop    loop_1