News:

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

Why isn't this working???

Started by prodigy, August 10, 2006, 09:26:11 AM

Previous topic - Next topic

prodigy

.data?

imagelist dd ?
hBmpLnr dd ?
imageinf  IMAGEINFO <>

invoke ImageList_LoadImage,hInst,IDB_STRIP,9,3,CLR_DEFAULT,IMAGE_BITMAP,LR_CREATEDIBSECTION
mov imagelist1,eax
invoke ImageList_GetImageInfo,imagelist1,2,addr imageinf
mov eax,imageinf.hbmImage
mov      hBmpLnr,eax


then later...

invoke CreateWindowEx,NULL,addr szButton,NULL,BS_BITMAP or BS_PUSHLIKE or BS_AUTOCHECKBOX or WS_CHILD or WS_VISIBLE,0,0,0,0,hWin,-2,hInstance,0
mov      [ebx].EDIT.hlin,eax
mov      edx,offset szLineNumber
call   SetToolTip
invoke SendMessage,[ebx].EDIT.hlin,BM_SETIMAGE,IMAGE_BITMAP,hBmpLnr

I am trying to put alitt oooomf... in the RAEdit with some nice sharp 32 images for a project i'm working on... If you know what is wrong with this code please tell me...

and also...

If there an easier way to get an image from an imagelist into an HBITMAP

let me know that as well....

Thanks for your help....

cheers


Tedd

invoke ImageList_LoadImage,hInst,IDB_STRIP,9,3,CLR_DEFAULT,IMAGE_BITMAP,LR_CREATEDIBSECTION
Apparently, the identifier should be a string, not a resource id. I would hope you can just use an id too, but for now (until you get it working) use a string resource name :wink
Width of each image is 9? Should that be 32? This is the width/height of the images in pixels, not the number of images.
Not sure about the flags value - see what happens if you leave it null.

The rest may be okay..

The next step would be debugging to make sure the calls to the imagelist functions actually succeed.
No snowflake in an avalanche feels responsible.

prodigy

#2
how do i define an image in the resource with a string???

Anyone with alittle more understanding of winapi help...

Okay number one. I know I am the one that ask for help... But do not insult my intelligence... I read up on the arguments...

GetBitmapInfo is suppose to put a handle to the specific bitmap inside that that structure...

And it is not doing this... Anyone know?

Tedd

I apologise if my reply was a little rushed, I simply browsed over what you posted and picked out things which 'could' be wrong - without actually having time to test them. I made no suggestions about your level of intelligence - it's simple enough to make a small mistake and not notice it. So please don't insult MY intelligence, when I'm actually attempting to help you (and given your attitude, I really shouldn't bother.)

Now, ImageList_LoadImage seems to work fine with a resource-id now that I've had a chance to test it (my documentation does say "Pointer to a null-terminated string that contains the name of the image to load." -- which is why I made such a suggestion.)

After playing with ImageList_GetImageInfo, I can say that it does put the value of 'something' into IMAGEINFO.hbmImage, but what that actually represents is another matter. It seems to be the same value for whichever image index you give it. This could simply imply that it re-uses a spare bitmap in which to draw the image.. but the doc says hBmImage is actually a "bitmap containing the images" so then it could be that it contains a number of images including the one requested. So then what what's the use of this function?! Hmm.. good question :bdg
I actually just tried to get the hbitmap stored drawn onto a window, but no such luck - however, this doesn't mean it's not a valid bitmap, there is a limitation that means a bitmap can only be selected into one dc at a time. Either way, it doesn't look like this function will be much help to you.

Sooo.. to solve your actual problem - the simplest thing to do would be including all the bitmaps as separate images and loading them individually with LoadBitmap, which is admittedly a little wasteful. Alternatively you could load the single bitmap (LoadBitmap), and then fiddle around trying to extract each bitmap separately to get a hbitmap to pass on, which isn't necessarily any more efficient.

If your aim is for a toolbar, check out CreateToolbarEx :P
No snowflake in an avalanche feels responsible.