Seems like the current available Win32 API documentation is inaccurate and / or incomplete regarding how to pass extra data properly using TCM_SETITEMEXTRA message and TCITEMHEADER structure.
First of all (as people also noted in a few other online forums), for TCITEMHEADER the TCIF_PARAM flag in "mask" parameter must be set the same way as in <https://learn.microsoft.com/en- us/windows/win32/api/commctrl/ns-commctrl-tcitema#members> when used for getting or setting a tab item's data. <https://learn.microsoft.com/en- us/windows/win32/api/commctrl/ns-commctrl-tcitemheadera#members> omits this information. Secondly, unlike the way documented in <https://learn.microsoft.com/en- us/windows/win32/api/commctrl/nf-commctrl-tabctrl_setitemextra> the TabCtrl_SetItemExtra macro indeed has a success/failure return value, it is clear from CommCtrl.h. And finally, the data size requirement when one wants to pass extra data using TCITEMHEADER is inaccurately documented as well. <https://learn.microsoft.com/en-us/windows/win32/controls/tcm- setitemextra#remarks> says "By default, the number of extra bytes is four." which is valid for 32-bit apps/calls only. In 64-bit apps this default size appears to be 8 bytes since if you set this size by sending a TCM_SETITEMEXTRA message then it is silently discarded and things fall back to the old way when TCITEM is used: you get a 4-byte-long truncated value again when getting tab info and the same wrong _value_ passed through messages containing DRAWITEMSTRUCTs (and not reference to the extra data, as described in <https://learn.microsoft.com/en- us/windows/win32/controls/tab-controls?redirectedfrom=MSDN#owner-drawn- tabs>). As a workaround, to avoid the extra data size to be either 4 or 8, a dummy byte is added to the extra data structure which makes things work in both architectures. ** Changed in: dcplusplus Status: Confirmed => Fix Committed -- You received this bug notification because you are a member of Dcplusplus-team, which is a bug assignee. https://bugs.launchpad.net/bugs/2019492 Title: Tab control crash Win10+ Status in DC++: Fix Committed Bug description: When running DC++ compiled under MSVC (Currently using VS2022) and running on Win10+ DC++ will crash when using OwnerDrawn tabs and selecting button style which will cause DC++ to immediately crash in TabView->handlePainting (You can force this crash on every startup by going into DCPlusPlus.xml and setting the following <TabStyle type="int">6</TabStyle>. To manage notifications about this bug go to: https://bugs.launchpad.net/dcplusplus/+bug/2019492/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~linuxdcpp-team Post to : linuxdcpp-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~linuxdcpp-team More help : https://help.launchpad.net/ListHelp