Raymond Chen

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.

Post by this author

Researchers find connection between lack of sleep and weight gain

Shortage of sleep is linked to obesity , according to research published yesterday. Lack of sleep boosts levels of a hormone that triggers appetite and lowers levels of a hormone that tells your body it is full according to the team. The scientists will now study whether obese people should sleep more to lose weight...

Dragging a shell object, part 2: Enabling the Move operation

Let's say that we did want to support Move in our drag/drop program, for whatever reason. Let's do it with some scratch file instead of clock.avi, though. Create a file somewhere that you don't mind losing; let's say it's C:\throwaway.txt. Change the function OnLButtonDown as follows: void OnLButtonDown(HWND hwnd, BOOL fDoubleClick...

Dragging a shell object, part 1: Getting the IDataObject

The shell gives you the IDataObject; all you have to do is drag it around.

Why are documents printed out of order when you multiselect and choose “Print”?

If you select say five files and then right-click them and choose "Print", they tend to print in a random order. Why is that? The shell invokes the Print verb on each file in turn, and depending on how the program responsible for printing the document is registered, one of several things can happen. These three ways of registering ...

Why did Windows 95 run the timer at 55ms?

The story behind the 55ms timer tick rate goes all the way back to the original IBM PC BIOS. The original IBM PC used a 1.19MHz crystal, and 65536 cycles at 1.19MHz equals approximately 55ms. (More accurately, it was more like 1.19318MHz and 54.92ms.) But that just pushes the question to another level. Why 1.19...MHz, then? With that ...

What is the purpose of the bmPlanes member of the BITMAP structure?

Many bitmap-related structures in Windows have a field called "planes". For example the structure has a member (which must be set to 1). The structure has a field called . What's the deal with that field? The EGA video adapter supported 16 simultaneous colors. This was an enormous improvement over the CGA, which supported only four ...

What’s the difference between GetKeyState and GetAsyncKeyState?

I've seen some confusion over the difference between the function and the function. returns the virtual key state. In other words, reports the state of the keyboard based on the messages you have retrieved from your input queue. This is not the same as the physical keyboard state: When should you use and when should you use...

Why doesn’t the RunAs program accept a password on the command line?

The RunAs program demands that you type the password manually. Why doesn't it accept a password on the command line? This was a conscious decision. If it were possible to pass the password on the command line, people would start embedding passwords into batch files and logon scripts, which is laughably insecure. In other words, the ...

Simple things you can do with the ShellExecuteEx function

Here's a tiny little program: #include <windows.h> #include <shellapi.h> int __cdecl main(int argc, char **argv) { if (argc == 3) { SHELLEXECUTEINFO sei = { sizeof(sei) }; sei.fMask = SEE_MASK_FLAG_DDEWAIT; sei.nShow = SW_SHOWNORMAL; // added 27 Nov sei.lpVerb = argv[1]; sei.lpFile = argv[2]; ...

A sample of desktop icon text effects

So you can see what they look like.