Answers to exercises from Scrollbars Part 10

Raymond Chen

Exercise: Explain why we used 0x7FFF to represent infinite height.

Answer: Commenter “Reiko” got this right. 0x7FFF is the maximum integer coordinate supported by Windows 95, 98 and Me.

Exercise: Explain the line rcWindow.bottom += rcTemp.top.

Answer: The more precise way of writing the line would have been

    rcWindow.bottom += (rcTemp.top - rcWindow.top) - (0 - rcWindow.top);

The first term is the amount of non-client space consumed at the top of the window. The second term is the amount of non-client space consumed at the top of the window, taking wrapping into account. The difference, therefore is the amount by which AdjustWindowRectEx needs to be adjusted. But the two instances of rcWindow.top cancel out, leaving just rcTemp.top.

0 comments

Discussion is closed.

Feedback usabilla icon