The Old New Thing

Answers to exercise from Scrollbars Part 11
Answers to exercise from Scrollbars Part 11
Exercise: Why do we use the formula c = a + (b-a)/2 instead of the simpler c = (a+b)/2? Answer: To avoid integer overflow in the computation of a+b. Here, a and b are window coordinates, and the window can be anywhere. If the window were placed at extreme coordinates like (...
Comments are closed.0Code
Scrollbars part 12: Applying WM_NCCALCSIZE to our scrollbar sample
Scrollbars part 12: Applying WM_NCCALCSIZE to our scrollbar sample
Now that we have learned about the intricacies of the WM_NCCALCSIZE message, we can use it to get rid of the flicker in our resizing code. We just take the trick we used above and apply it to the scroll program. First, we need to get rid of the bad flickery resize, so return the ...
Comments are closed.0Code
Why does Win32 fail a module load if an import could not be resolved?
Why does Win32 fail a module load if an import could not be resolved?
Because we tried it the other way and it was much worse. In 16-bit Windows, a module that didn't satisfy all its imports would still load. As long as you didn't call a missing import, you were fine. If you did try to call a missing import, you crashed pretty spectacularly with the ...
Eric's complete guide to BSTR semantics
Eric's complete guide to BSTR semantics
Eric Lippert has posted Eric's Complete Guide to BSTR Semantics. This is a document that is widely valued within Microsoft, since BSTR semantics are rather tricky, and I'm glad he's willing to share it with the world. In particular, Eric spends quite a bit of time discussion the very ...
Comments are closed.0Code
Something about Microsoft employees and milk
Something about Microsoft employees and milk
Behold the power of milk. Or something. Here's another milk-related bug report from Paul Vick. Paul also has a bug report that challenges the philosophical underpinnings of the eventing model...
Comments are closed.0Other
I'm not sure if this was a dare
I'm not sure if this was a dare
Joe Beda stopped by my office, clutching a stack of documents he had just had notarized, and told me, "Raymond, you should become a notary public." "Why?" "It'd be fun." "Notarizing documents is fun?" "No, just being a notary public - just...
Whimsical bug reports
Whimsical bug reports
Whimsical bug reports, while not a common occurence, aren't exactly unheard of either. They are a popular way to vent a shared frustration and lighten the mood. Recently, we changed milk suppliers for our cafeterias. Well, more accurately, our previous milk supplier was bought by another milk ...
Comments are closed.0Other
Why does the taskbar default to the bottom of the screen?
Why does the taskbar default to the bottom of the screen?
It didn't always. The original taskbar didn't look at all like what you see today. It defaulted to the top of the screen and looked something like this. This is definitely not what it actually looked like. It has been so long I forgot precisely what it looked like (I didn't realize there was going to be a quiz ten years later), but ...