I am trying to create a color icon dynamically in memory. I have not been able to get CreateIcon() to work. Would anyone have source or a link to help illustrate. Thanks.
Dynamically?
Your making some sorta ICON generator? Or are you trying to get the ICON pic from memory and then painting it somewhere on your window? (The latter i can help you with)
NaN
Your making some sorta ICON generator? Or are you trying to get the ICON pic from memory and then painting it somewhere on your window? (The latter i can help you with)
NaN
Nan,
I am trying to create a color icon dynamically (not loaded from the exe or from a .ico file) instead of LoadIcon(). I got monochrome to work, but could not get my XORbitmask parm to be accepted by CreateIcon(). I am now trying to decypher the in memory resource format to use CreateIconFromResource(). I am open to other suggestions.
Thanks
I am trying to create a color icon dynamically (not loaded from the exe or from a .ico file) instead of LoadIcon(). I got monochrome to work, but could not get my XORbitmask parm to be accepted by CreateIcon(). I am now trying to decypher the in memory resource format to use CreateIconFromResource(). I am open to other suggestions.
Thanks
You got me curious, so i tinkered for about and hour with Icons..
I found that CreateIcon() is mainly suited for Black and White images.. as i got it to work with this.. It did sugest a refernce to BITMAPS if i wanted to make a color one, but doesnt say _how_.
I also tried CreateIconIndirect( addr INCOINFO ), I found this method very easy to make an icon.
I realize this isnt as direct as CreateIcon() is, hence the name *Indirect*. But you could most likely get what ever you want done with this one faster. For instance you would create a separate DC, and then Create a Bitmap and select it to the dc. Then take stored information (in any cryptic format you choose), decifer it and plot pixels to this bitmap. Then lastly use CreateIconIndirect to create an icon from the bitmap you just drew.
Kind of a long way around.. but its the only solution i can make sence outa, as your right, the xorMask is hard to understand.
Hope This Helps...
NaN
I found that CreateIcon() is mainly suited for Black and White images.. as i got it to work with this.. It did sugest a refernce to BITMAPS if i wanted to make a color one, but doesnt say _how_.
I also tried CreateIconIndirect( addr INCOINFO ), I found this method very easy to make an icon.
LOCAL ii :ICONINFO
invoke LoadBitmap, hInstance, 700
mov hBitmap, eax
...
mov ii.fIcon, TRUE
mov eax, hBitmap
mov ii.bmMask, eax ; also works with -1
mov ii.bmColor, eax ; must for color icons..
invoke CreateIconIndirect, addr ii
mov hIcon, eax
...
invoke DrawIconEx, ps.hdc, 50, 50, hIcon, 20, 20, NULL, NULL, DI_NORMAL
..
invoke DestroyIcon, hIcon
invoke DeleteObject, hBitmap
I realize this isnt as direct as CreateIcon() is, hence the name *Indirect*. But you could most likely get what ever you want done with this one faster. For instance you would create a separate DC, and then Create a Bitmap and select it to the dc. Then take stored information (in any cryptic format you choose), decifer it and plot pixels to this bitmap. Then lastly use CreateIconIndirect to create an icon from the bitmap you just drew.
Kind of a long way around.. but its the only solution i can make sence outa, as your right, the xorMask is hard to understand.
Hope This Helps...
NaN
NaN,
With your help, I also got CreateIconIndirect() to work.
Thanks,
MM
With your help, I also got CreateIconIndirect() to work.
Thanks,
MM