Quote Originally Posted by ZaidK View Post
Books(the Charles Petzold one) say that there is a need of adding +1 while using the System colours like..

wndclass.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1)

I don't understand the need of that + 1 ? Can anyone helped in that. I am new to VC++ Programs
The system colours vary depending on the current style / theme.

These colours are stored in an array and the IDs (like COLOR_BTNFACE) are defined integer values.

The first element of the array is 0 (in C / C++) but you need a way to tell the OS that you ment to get an element of the array, not 'no colour' (ie NULL).

So the +1 is used to tell the difference between (HBRUSH)NULL and (HBRUSH)0 (which means get me the system colour from the array at index zero)


http://social.msdn.microsoft.com/for...-7d78338c17d2/