Showing results for History - The Old New Thing

Nov 1, 2004
Post comments count0
Post likes count0

What was the difference between LocalAlloc and GlobalAlloc?

Raymond Chen
Raymond Chen

Back in the days of 16-bit Windows, the difference was significant. In 16-bit Windows, memory was accessed through values called "selectors", each of which could address up to 64K. There was a default selector called the "data selector"; operations on so-called "near pointers" were performed relative to the data selector. For example, if you had ...

History
Oct 29, 2004
Post comments count0
Post likes count0

Why didn’t the desktop window shrink to exclude the taskbar?

Raymond Chen
Raymond Chen

The taskbar created all sorts of interesting problems, since the work area was not equal to the entire screen dimensions. (Multiple monitors created similar problems.) "Why didn't the gui return the usable workspace as the root window (excluding the taskbar)?" That would have made things even worse. Lots of programs want to cover the entire sc...

History
Oct 28, 2004
Post comments count0
Post likes count1

Where did windows minimize to before the taskbar was invented?

Raymond Chen
Raymond Chen

Before Explorer was introduced in Windows 95, the Windows desktop was a very different place. The icons on your desktop did not represent files; rather, when you minimized a program, it turned into an icon on the desktop. To open a minimized program, you had to hunt for its icon, possibly minimizing other programs to get them out of the way...

History
Oct 22, 2004
Post comments count0
Post likes count0

Why doesn’t Setup asks you if you want to keep newer versions of OS files?

Raymond Chen
Raymond Chen

Windows 95 Setup would notice that a file it was installing was older than the file already on the machine and would ask you whether you wanted to keep the existing (newer) file or to overwrite it with the older version. Asking the user this question at all turned out to have been a bad idea. It's one of those dialogs that ask the user a qu...

History
Oct 20, 2004
Post comments count0
Post likes count0

How does Explorer detect whether your program supports long file names?

Raymond Chen
Raymond Chen

When you register your program with a file association, the shell needs to decide whether your program supports long file names so it can decide whether to pass you the long name (which may contains spaces! so make sure you put quotation marks around the "%1" in your registration) or the short name. The rule is simple: The shell looks at your pr...

History
Oct 19, 2004
Post comments count0
Post likes count0

The compatibility constraints of even your internal bookkeeping

Raymond Chen
Raymond Chen

The Listview control when placed in report mode has a child header control which it uses to display column header titles. This header control is the property of the listview, but the listview is kind enough to let you retrieve the handle to that header control. And some programs abuse that kindness. It so happens that the original listview...

History
Oct 11, 2004
Post comments count0
Post likes count1

What’s the atom returned by RegisterClass useful for?

Raymond Chen
Raymond Chen

The and functions return an What is that good for? The names of all registered window classes is kept in an atom table internal to USER32. The value returned by the class registration functions is that atom. You can also retrieve the atom for a window class by asking a window of that class for its class atom via . The atom can be convert...

History
Oct 8, 2004
Post comments count0
Post likes count0

Why is there a separate GetSystemDirectory function?

Raymond Chen
Raymond Chen

If the system directory is always , why is there a special function to get it? Because it wasn't always that. For 16-bit programs on Windows NT, the system directory is . That's also the name of the system directory for Windows 95-based systems and all the 16-bit versions of Windows. But even in the 16-bit world, if it was always...

History
Oct 5, 2004
Post comments count0
Post likes count0

The macros for declaring and implementing COM interfaces

Raymond Chen
Raymond Chen

There are two ways of declaring COM interfaces, the hard way and the easy way. The easy way is to use an IDL file and let the MIDL compiler generate your COM interface for you. If you let MIDL do the work, then you also get __uuidof support at no extra charge, which is a very nice bonus. The hard way is to do it all by hand. If you choose th...

History
Sep 10, 2004
Post comments count0
Post likes count1

Sometimes the bug isn’t apparent until late in the game

Raymond Chen
Raymond Chen

I didn't debug it personally, but I know the people who did. During Windows XP development, a bug arrived on a computer game that crashed only after you got to one of the higher levels. After many saved and restored games, the problem was finally identified. The program does its video work in an offscreen buffer and transfers it to the sc...

History