The MASM Forum

General => The Campus => Topic started by: Mikl__ on June 08, 2019, 03:23:49 PM

Title: How to adding icons to tab controls?
Post by: Mikl__ on June 08, 2019, 03:23:49 PM
May show a small example for 2-3 tabs? Thank you...
Title: Re: How to adding icons to tab controls?
Post by: Biterider on June 08, 2019, 04:08:47 PM
Hi Mikl__
Maybe this can help.
After creating the control
invoke CreateWindowEx, dExStyle, $OfsCStr("SysTabControl32"), pTitle, \
                         dStyle, sdPosX, sdPosY, dWidth, dHeight, \
                         hParent, CtlID, hInstance, 0


add an imagelist using
invoke SendMessage, hWnd, TCM_SETIMAGELIST, 0, hImageList

For each tab you want to add, use

local TCI:TC_ITEM

mov TCI.mask_, TCIF_PARAM or TCIF_TEXT or TCIF_IMAGE
mrm TCI.pszText, pText, xax
mrm TCI.iImage, dImageIndex, eax
mrm TCI.lParam, hWnd, xax
invoke SendMessage, hWnd, TCM_INSERTITEM, dIndex, addr TCI


and you are done.

Note: if the Tab control is to be placed in a dialog, don't forget to use the MapDialogRect to convert from dialog box units to pixels.

Biterider
Title: Re: How to adding icons to tab controls?
Post by: six_L on June 09, 2019, 11:37:39 PM
look the attachment.
Title: Re: How to adding icons to tab controls?
Post by: Mikl__ on June 14, 2019, 09:40:12 AM
Hi, Biterider, six_L!
Thank you very much for the help!