September 13th, 2003

Answers to exercises from Scrollbars Part 10

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.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.