News:

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

Insert Icons into Tab in Tabstrip control

Started by RHL, April 11, 2012, 09:02:47 PM

Previous topic - Next topic

RHL

hello guys, well, today I try insert a icons into Tab in tabstrip control.
for the moment I make this:

.if eax==WM_INITDIALOG
invoke GetDlgItem,hWin,1001 ; get tabstrip control
mov mytabstrip,eax


; Load -------------------------------------------------------------
; statements:
; TC_I            TC_ITEM <>
; INFO_TAB NMHDR <>

invoke ImageList_Create,32,32,ILC_COLOR32,1,10 ; create image list ( icons with 32x32 in resouce )
mov         handlelist,eax ; save

invoke LoadBitmap,hInstance,777 ; 777 = icon ID
mov         handlebitm,eax ; save handle to icon

invoke ImageList_Add,handlelist,handlebitm,NULL ; is right?
invoke DeleteObject,handlebitm

invoke SendMessage,mytabstrip,TCM_SETIMAGELIST,0,handlelist ; insert imagelist is right?


        mov     TC_I.imask,TCIF_TEXT
mov     TC_I.pszText,offset NAMETAB ; NAMETAB = string name
mov     TC_I.cchTextMax,sizeof NAMETAB ;
mov     TC_I.iImage,0 ; index to handle to imagelist control
mov     TC_I.lParam,0

invoke  SendMessage,hTabmain,TCM_INSERTITEM,0,addr tci ; add one tab

      
but I do not work, could say that is wrong... thanks in advance

dedndave

invoke  DeleteObject,handlebitm
:naughty:

you delete the handle - which makes it invalid
now, the image list has an invalid handle in it
i don't think that's how it's supposed to work

also - you may need to use InitCommonControlsEx and a manifest file to get common controls v 6 (not sure)
see the RHLWin project we did last week for an example
1) create the manifest file (use the same file as RHLWin)
2) add it to the resource file
3) at the beginning of the program call InitCommonControlsEx with an INITCOMMONCONTROLSEX structure that has appropriate flags set

dedndave

ok - my mistake
it is ok to delete the object right away
apparently, it adds the image - not the handle

dedndave

there is an example in \masm32\examples\exampl04\treedemo

RHL

thanks u bro!  :bg :bg :bg :bg :bg :bg I did it
I needed the mask:

TVIF_TEXT or TVIF_IMAGE or TVIF_SELECTEDIMAGE   

now i want to make a mask for bitmap lol
bcz the bitmap show the background white :P

I have no idea how do same efect that Bitblt function :P