TabCtrl_SetImageList macro error in CommCtrl.bi

Windows specific questions.
Post Reply
PaulSquires
Posts: 1012
Joined: Jul 14, 2005 23:41

TabCtrl_SetImageList macro error in CommCtrl.bi

Post by PaulSquires »

The macro in 'commctrl.bi' for TabCtrl_SetImageList is incorrect. It will cause a compile time error.

Code: Select all

' Incorrect
#define TabCtrl_SetImageList(w,h) cast((HIMAGELIST,SNDMSG(w,TCM_SETIMAGELIST,0,cint(cUINT(h))))

' Correct
#define TabCtrl_SetImageList(w,h) cast(HIMAGELIST,SNDMSG(w,TCM_SETIMAGELIST,0,CInt(h)))
PaulSquires
Posts: 1012
Joined: Jul 14, 2005 23:41

Post by PaulSquires »

Likewise, there is an error in the TabCtrl_AdjustRect macro. It is missing a trailing closing parenthesis ")".

Code: Select all

'Incorrect:
#define TabCtrl_AdjustRect(w,b,p) cint(SNDMSG(w,TCM_ADJUSTRECT,b,cint(cast(LPRECT,p)))

'Correct:
#define TabCtrl_AdjustRect(w,b,p) CInt(SNDMSG(w,TCM_ADJUSTRECT,b,CInt(cast(LPRECT,p))))
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Post by dkl »

I applied the fixes at freebasic-headers, thanks.
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: TabCtrl_SetImageList macro error in CommCtrl.bi

Post by counting_pine »

PaulSquires wrote:The macro in 'commctrl.bi' for TabCtrl_SetImageList is incorrect. It will cause a compile time error.

Code: Select all

' Incorrect
#define TabCtrl_SetImageList(w,h) cast((HIMAGELIST,SNDMSG(w,TCM_SETIMAGELIST,0,cint(cUINT(h))))

' Correct
#define TabCtrl_SetImageList(w,h) cast(HIMAGELIST,SNDMSG(w,TCM_SETIMAGELIST,0,CInt(h)))
For what it's worth, from http://source.winehq.org/source/include ... rl.h#L4047 it looks like (at least) one extra cast is warranted on the h parameter.
Therefore I think a better change would just be to remove the (obviously) erroneous extra '(' near the start ('cast((HIMAGELIST,...')
Post Reply