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
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.
Sorry ToutEnMasm. I'm not clarified. I did it all manually. Old school works always.
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:
thanks jj. still not working.
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.
Ty Vortex
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
Also doesnt result with resource name type string.
ok... it's working now. thanks guys... you're the best.
Now please tell us what was the problem - we are a curious bunch :bgrin:
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?
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 (https://www.c-plusplus.net/forum/48288-full)
;
...
invoke ImageList_AddMasked, imgList, hBitmap, 0
... with success :cool:
Ty JJ. I'll check that out. Thanks
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
Hi xandaz,
is hIml != NULL ?
Is the loaded bitmap compatible to the ImageList (24bit) ?
Have you tried ILC_COLOR32 instead of ILC_COLOR24 ?
Kind regards
Greenhorn
hIml is valid. the problem is very likely to be the FLAGS on ImageList_Create. I'm checking that. thanks
Hey...tried all thw flags. dosent work. It only works the previous way. Loading image from file. Could it be because it's a UNICODE app?
These lines of code work perfectlly. I feel like cracking my head about this. Damn OS's have these gliches makes a guy go crazy.
invoke ImageList_Create,32,32,ILC_COLOR32,9,18
mov hIml,eax
mov ecx,9
lea esi,mdicreate
cld
loop_1:
push ecx
invoke LoadImage,0,esi,IMAGE_BITMAP,32,32,LR_LOADFROMFILE
invoke ImageList_AddMasked,hIml,eax,0
loop_2:
lodsw
or al,al
jnz loop_2
pop ecx
loop loop_1
Quote from: xandaz on November 04, 2020, 06:35:46 AM
These lines of code work perfectlly
lodsw? Sure it isn't lods
b?
Quote from: xandaz on November 04, 2020, 06:18:07 AMCould it be because it's a UNICODE app?
What do you see in the debugger? Are you passing the correct string, i.e. Ansi for LoadImageA or Unicode for LoadImageW?
no. like i said it's working, those are unicode strings pointed by esi.
Hey thank you guys. Like i said: it's working perfectlly using LoadImage/LR_LOADFROMFILE. Doesn't work with LoadBitmap,hInstance,resource_number. Why the hell is that?
Hey guys again. I got it to work with LoadImage and LR_SHARED Flag set. Problem solved. Thanks a lot guys.
Try to use LR_CREATEDIBSECTION in LoadImage flags if you load from EXE/DLL.
ILC_COLOR32 creates a DIB section in ImageList_Create.
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadimagew (https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadimagew)
https://docs.microsoft.com/en-us/windows/win32/controls/ilc-constants (https://docs.microsoft.com/en-us/windows/win32/controls/ilc-constants)
Kind regards
Greenhorn
hi, xandaz!
better late than never. Show here (https://translate.google.com/translate?sl=ru&tl=en&u=https://wasm.in/threads/skazki-djadjushki-rimusa.31832/page-3%23post-383943)
Hi xandaz,
You could also try the bitmap from file method :
http://masm32.com/board/index.php?topic=4642.msg49923#msg49923
Thanks guys. You're the best.