The Old New Thing

You cannot globally reserve user-mode address space

Occasionally, somebody asks for a way to reserve user-mode address space globally. In other words, they want to allocate address space in all processes in the system (current and future). Typically this is because they want to map some memory into each process and don't want to go through the trouble of designing the shared memory blocks so ...

How to act like you know Chinese even though you don't

I was riding in a car with a friend when a Chinese pop album spun up on the CD. I made a remark about the song, and my friend, knowing that I was studying Mandarin, asked me, "Do you know what she's singing about?" I immediately replied, "She's singing about love." "Wow," my friend responded. "Your Chinese is quite good." "Nope," I said. "...

LoadLibraryEx(DONT_RESOLVE_DLL_REFERENCES) is fundamentally flawed

There is a flag to the function called . The documentation says, If this value is used, and the executable module is a DLL, the system does not call DllMain for process and thread initialization and termination. Also, the system does not load additional executable modules that are referenced by the specified module. If you are ...

Windowless controls are not magic

It seems that when people notice that the Internet Explorer rendering engine doesn't use HWNDs for screen elements, they think that Internet Explorer is somehow "cheating" and doing something "undocumented" and has an "unfair advantage". Nevermind that windowless controls have been around since 1996. They aren't magic. Mind you, they're a ...

Why do minimized windows have an apparent size of 160×31?

We discussed a few months ago the issue of where windows minimized to before the taskbar was invented. In the modern taskbar world, why do minimized windows have an apparent size of 160x31? The size isn't just apparent. That's really their size. You can see them, for example, if you fire up a program that uses the Multiple Document ...

The dangers of filtering window messages

The and functions allow you to pass a filter, restricting the window handle or range of messages that the function will retrieve from the message queue. While it's okay to use these filters, make sure you eventually get around to making an unfiltered call so that any straggling messages can come through. A common mistake is to use a ...

What other effects does DS_SHELLFONT have on property sheet pages?

Once you invent a new flag you can start using it to fix errors of the past without breaking backwards compatibility. One of the errors of the past was that property sheet page dimensions were taken relative to the "MS Sans Serif" font, even if the page used some other font. This sample dialog template says that it is 212dlu wide and ...

Why does DS_SHELLFONT = DS_FIXEDSYS | DS_SETFONT?

You may have noticed that the numerical value of the flag is equal to . Surely that isn't a coincidence. The value of the flag was chosen so that older operating systems (Windows 95, 98, NT 4) would accept the flag while nevertheless ignoring it. This allowed people to write a single program that got the "Windows 2000" ...

What's the deal with the DS_SHELLFONT flag?

It indicates that you want the Windows 2000 default shell font. But that doesn't mean that you're going to get it. In order to indicate that you would like the "Windows 2000" look for your dialog, you have to do three things and hope for a fourth: If all four conditions are satisfied, then your dialog gets the "Windows 2000...

Why is breadth-first searching better for file system tree walking?

Earlier, Eric Lippert discussed one scenario where breadth-first searching is better than depth-first searching. Today, I'll tell you about another. If you go back to the old MS-DOS file enumeration functions, you'll find that there is a "Find first file" function and a "Find next file" function, but no "Find close" function. That's because...