The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Why does my control send its notifications to the wrong window after I reparent it?
Mar 16, 2010
Post comments count 0
Post likes count 0

Why does my control send its notifications to the wrong window after I reparent it?

Raymond Chen
Raymond Chen

Because it's still talking to the old parent.

Robots and humans coexisting, can it be done peacefully?
Mar 15, 2010
Post comments count 0
Post likes count 0

Robots and humans coexisting, can it be done peacefully?

Raymond Chen
Raymond Chen

Everybody who follows science fiction knows that if you have robots and humans living in the same world, eventually something bad happens to the humans.¹ But we're going to chance it one more time. Every so often, I stumble across a Web site that translates my articles into another language. I occasionally see a Japanese translation, and I think there's a Russian translation out there somewhere. In addition to those human translations, there are also robot translations available through your favorite online translation service. Now the two can coexist. There's a new widget on this page which generat...

A window can have a parent or an owner but not both
Mar 15, 2010
Post comments count 0
Post likes count 1

A window can have a parent or an owner but not both

Raymond Chen
Raymond Chen

One of the five things every Win32 programmer should know.

Simplifying context menu extensions with IExecuteCommand
Mar 12, 2010
Post comments count 0
Post likes count 0

Simplifying context menu extensions with IExecuteCommand

Raymond Chen
Raymond Chen

The interface is a simpler form of context menu extension which takes care of the annoying parts of so you can focus on your area of expertise, namely, doing the actual thing the user selected, and leave the shell to doing the grunt work of managing the UI part. I've never needed a scratch shell extension before, so I guess it's time to create one. This part is completely boring, and those of you who have written COM inproc servers can skip over it. I'm assuming that the above code is all old hat. Consider it a prerequisite. Okay, now the good stuff. The interface is used when you create a static reg...

Why does the OLE variant date format use 30 December 1899 as its zero point?
Mar 12, 2010
Post comments count 0
Post likes count 0

Why does the OLE variant date format use 30 December 1899 as its zero point?

Raymond Chen
Raymond Chen

It's a long, sad story.

Application compatibility layers are there for the customer, not for the program
Mar 11, 2010
Post comments count 0
Post likes count 0

Application compatibility layers are there for the customer, not for the program

Raymond Chen
Raymond Chen

The customer is the victim, not the program.

One of the consequences of accepting a job offer is that you might end up working with an interviewer who didn't like you
Mar 10, 2010
Post comments count 0
Post likes count 0

One of the consequences of accepting a job offer is that you might end up working with an interviewer who didn't like you

Raymond Chen
Raymond Chen

At an informal gathering, my colleagues and I started talking about our experiences being interviewed at Microsoft. One of the people there remembered how one of the pieces of feedback on the interview lo these many years ago was that although my colleague was certainly smart enough and hardworking enough, there seemed to be insufficient enthusiasm for the subject matter. I mean, my colleague cared about the subject matter but apparently didn't care enough to satisfy the interviewer. The offer was extended despite this reservation, and my colleague joined the team. Years passed, and the details of the encounter w...

Why is the fine for a basic traffic infraction in the state of Washington such a random-looking number?
Mar 9, 2010
Post comments count 0
Post likes count 0

Why is the fine for a basic traffic infraction in the state of Washington such a random-looking number?

Raymond Chen
Raymond Chen

Willy-Peter Schaub was puzzled by a sign reminding drivers that the fine for obstructing an intersection is $101 and wonders what the extra $1 is for. The laws of the State of Washington defer the monetary value of traffic fines to the Infraction Rules for Courts of Limited Jurisdiction (more commonly known as the IRLJ), specifically section 6.2: Monetary Penalty Schedule for Traffic Infractions [pdf]. But wait, the fine listed in the IRLJ is only $42. Where did $101 come from? In addition to the base fine in the IRLJ, RCW 3.62.090 specifies additional assessments: Section (1) specifies a 70% assessment f...

PSM_ISDIALOGMESSAGE is to modeless property sheets as IsDialogMessage is to modeless dialog boxes
Mar 9, 2010
Post comments count 0
Post likes count 0

PSM_ISDIALOGMESSAGE is to modeless property sheets as IsDialogMessage is to modeless dialog boxes

Raymond Chen
Raymond Chen

Dialog boxes and property sheets are similar in that most of the time, you use them modally. You call or , and the function doesn't return until the user closes the dialog box or property sheet. But you can also use dialog boxes and property sheets modelessly, using or by including the flag when you call . One of the more common problems people have when managing a modeless property sheet is finding that keyboard navigation doesn't work. The reason is the same as with modeless dialog boxes: You forgot to process dialog messages. But if you use the wrong function to process the dialog messages, then you don't...