The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Aug 19, 2009
Post comments count 0
Post likes count 0

There’s no law that says a meeting can’t end early

Raymond Chen

If you're finished early, then finish early.

Aug 18, 2009
Post comments count 0
Post likes count 1

Microspeak: Action on

Raymond Chen

I have been fortunate to have been spared exposure to this particular corner of Microspeak, but others have not been so lucky. Have you actioned on this ask? It's not clear whether actioning on something means that you've started it or you've finished it. As a result, this is another case of using jargon to impede communication. The inventors of this particular form of Microspeak must be proud of themselves, for not only have they verbed a noun, they coupled it with an unnecessary preposition. But they aren't content to stop there. It wasn't long before the noun that got verbed got re-nouned! Here is our l...

Aug 17, 2009
Post comments count 0
Post likes count 1

The format rectangle is recalculated whenever the window resizes, and that's a good thing

Raymond Chen

Reader asmguru62 asks why a custom format rectangle of a multi-line edit control is lost when the edit control is resized. That's right, the format rectangle is recalculated whenever the window resizes, and that's a good thing. Imagine if it weren't recalculated. You create a multi-line edit control. Like many programs, you might create it at a temporary size while you try to figure out what its real size should be. You might even resize the control dynamically as the container is resized. (After all, everybody wants resizable dialogs.) What you definitely don't want is the format rectangle of the edit control...

Aug 14, 2009
Post comments count 0
Post likes count 0

It's not just on the Internet that nobody knows you don't have a real office

Raymond Chen

Sure, your company don't have an office, but that's okay. You can rent a fake one, with a fake receptionist, fake staff, and fake conference rooms, and whenever somebody stops by asking for you, the receptionist is trained to say that you're "out".

Aug 14, 2009
Post comments count 0
Post likes count 1

Why can't I declare a type that derives from a generic type parameter?

Raymond Chen

A lot of questions about C# generics come from the starting point that they are just a cutesy C# name for C++ templates. But while the two may look similar in the source code, they are actually quite different. C++ templates are macros on steroids. No code gets generated when a template is "compiled"; the compiler merely hangs onto the source code, and when you finally instantiate it, the actual type is inserted and code generation takes place. This is a perfectly legal (if strange) C++ template class. But when the compiler encounters this template, there are a whole bunch of things left unknown. What is th...

Aug 13, 2009
Post comments count 0
Post likes count 0

Landing the Space Shuttle is hard enough as it is

Raymond Chen

I was at The Museum of Flight and was waiting my turn at the Space Shuttle landing simulator. A six-year-old settled into the control seat, and as the simulation began I heard him ask his father, "Where are the bad guys?" I'm pretty sure the Space Shuttle doesn't come with onboard missiles. That didn't stop the kid from pressing the trigger on the joystick a lot, though. By the way, I cratered the Space Shuttle.

Aug 13, 2009
Post comments count 0
Post likes count 1

Common gotchas when writing your own p/invoke

Raymond Chen

If you're looking to get into some p/invoke action, you'd be well-served to check out the pinvoke wiki to see if somebody else has done it too. If what you need isn't there, you may end up forced to write your own, and here are some gotchas I've seen people run into: C++ and Win32 are not the same as C# (aka ). In Win32, is a 4-byte type, and is a 1-byte type. [See also MadQ's remarks about .] Meanwhile, C++ is not standardized by Win32, so the size will vary based on your compiler, but most compilers use a 1-byte value. And then C# is even weirder: T...

Aug 12, 2009
Post comments count 0
Post likes count 0

The wisdom of sev^H^H^Heighth graders: What it means to be an adult

Raymond Chen

Since I'm obviously a glutton for punishment, I also helped read eighth grade essays on the same topic: Describe the qualities you consider to be those which make someone an adult. As always, remember that these are just the funny sentences/excerpts. Let me tell you about my parents Entering a no fun zone It's harder than I thought Tautology corner Assorted commentary Misspelling corner. I've included more context; that may make the game a bit easier. And just so you won't think all eighth graders are terrible writers:

Aug 12, 2009
Post comments count 0
Post likes count 1

Why can't I pass a reference to a derived class to a function that takes a reference to a base class by reference?

Raymond Chen

"Why can't I pass a reference to a derived class to a function that takes a reference to a base class by reference?" That's a confusing question, but it's phrased that way because the simpler phrasing is wrong! Ths misleading simplified phrasing of the question is "Why can't I pass a reference to a derived class to a function that takes a base class by reference?" And in fact the answer is "You can!" Our call to passes a reference to the derived class to a function that takes a reference to the base class. This is perfectly fine. When people ask this question, they are typically wondering about passing a...