What really happens when you shutdown Windows?

About a year or so ago, I wrote a post that talked about the Windows shutdown experience.   A couple of the people reading the post asked for more details, and it turns out that the performance folks have just issued this paper which describes (in great detail) what happens during system boot and shutdown….

7

The common control library sometimes sends an NMCUSTOMDRAW message for the NM_CUSTOMDRAW notification.

I just fixed a bug in our UI that was caused by a misunderstanding of the API contract for the NM_CUSTOMDRAW handler for some of the common controls. On of October 3rd, 2008 The common control documentation for the NM_CUSTOMDRAW message says: lpNMCustomDraw A pointer to a custom draw-related structure that contains information about the…

7

DrawThemeText doesn’t really support the DT_CALCRECT format value

I just noticed this while working on a bug fix. We have some code that attempts to determine the size of a piece of text by calling DrawThemeText with the DT_CALCRECT format value. According to this page (as of 9/30/2008) the DT_CALCRECT option determines the width and height of the display rectangle. Unfortunately the DT_CALCRECT…

1

Why specify SND_NODEFAULT when calling PlaySound?

Because the alternative is often much worse.   Several months ago, I got a bug report that if you launched mmsys.cpl then set the “Select” sound to a value, then cleared the sound, the reporters application would ding whenever you moved around their tree control. I dug into the problem a bit and discovered that…

5

Why call PlaySound(NULL, NULL, SND_NODEFAULT)?

Someone just wandered over to my office and he had noticed the following pattern in his code: PlaySound(NULL, NULL, SND_NODEFAULT); PlaySound(".Default", NULL, SND_SYSTEM | SND_ASYNC | SND_NODEFAULT); He was wondering why on earth the code would do that call to PlaySound(NULL).  As I explained it to him, the reason is because you almost always want…

5

Anatomy of a Heisenbug

I just spent a half an hour debugging a heisenbug and thought I’d pass on what was happening.   I was running my unit tests for one of my features and they were reliably failing.  Unfortunately the instant I ran the test case under the debugger, the problem went away.  Problems that disappear under the…

15

Gotchas associated with using WM_PRINTCLIENT…

Yesterday I mentioned WM_PRINTCLIENT and how awesome it is when trying to strictly control the drawing of your application. Part of the reason it took over a week to change the drawing model is that there are a number of serious gotcha’s associated with using WM_PRINTCLIENT and controlling your own drawing story.  The first is…

22

Larry’s new favorite windows message – WM_PRINTCLIENT

As I’ve mentioned before, I’ve been fuddling around doing UI programming recently – it’s a bit different from my usual work deep in the bowels of the <insert whatever subsystem Larry happens to be working on (redirector, audio stack, POP3 server, whatever)>.   I’ve been having a great deal of fun doing the whole “UI…

18

What’s wrong with this code, Part 22 – the answers

The other day, I wrote about measuring the dimensions of a piece of text using the DrawText API. My code worked just great when I initially tested it (obviously it’s a part of a larger chunk of code that does more complicated work).  The problem showed up when I started testing it on a machine…

14