The Old New Thing

What is the DC brush good for?

The DC brush GetStockObject(DC_BRUSH) is a stock brush associated with the device context. Like the system color brushes, the color of the DC brush changes dynamically, but whereas the system color brushes change color based on the system colors, the color of the DC brush changes at your command. The DC brush is handy when you need a ...
Comments are closed.0Code

When people ask for security holes as features: Hiding files from Explorer

By default, Explorer does not show files that have the FILE_ATTRIBUTE_HIDDEN flag, since somebody went out of their way to hide those files from view. You can, of course, ask that such files be shown anyway by going to Folder Options and selecting "Show hidden files and folders". This shows files and folders even if they are marked as ...

Project update: Voyage to Our Hollow Earth

In December 2003, I reported on Steve Currey's expedition to the hole at the top of the earth, which at the time was scheduled for June 26, 2005. But on May 6, 2004, the site rescheduled the trip for Jun 26, 2006 with no explanation. The reservation form reminds you that the 25% deposit is non-refundable. Far be it from me to suggest that...

What is the HINSTANCE passed to CreateWindow and RegisterClass used for?

One of the less-understood parameters to the CreateWindow function and the RegisterClass function is the HINSTANCE (either passed as a parameter or as part of the WNDCLASS structure). The window class name is not sufficient to identify the class uniquely. Each process has its own window class list, and each entry in the window class list...
Comments are closed.0Code

News flash: Everybody has to pay income tax

NFL rookies are required to attend "How not to mess up your life like those other professional athletes" training. They learn about such things as sexual harassment, AIDS, common-law marriage, and, of course, taxes. Kendrell Bell, a Pittsburgh Steelers linebacker, tells of his great awakening to the verities of income tax: "I got a million-...

Tweaking our computation of the interval between two moments in time

We can take our computation of the interval between two moments in time and combine it with the trick we developed for using the powers of mathematics to simplify multi-level comparisons to reduce the amount of work we impose upon the time/date engine. Observe that we avoided a call to the AddYears method (which is presumably rather ...
Comments are closed.0Code

Computing the interval between two moments in time

Computing the interval between two moments in time is easy: It's just subtraction, but subtraction may not be what you want. If you are displaying time units on the order of months and years, then you run into the problem that a month is of variable length. some people just take the value relative to a base date of January 1 and extract ...
Comments are closed.0Code

Using the powers of mathematics to simplify multi-level comparisons

What a boring title. Often you'll find yourself needing to perform a multi-level comparison. The most common example of this is performing a version check when there are major and minor version numbers involved. Bad version number checks are one of the most common sources of errors. If you're comparing version numbers, you can use the ...
Comments are closed.0Code

There's an awful lot of overclocking out there

A bunch of us were going through some Windows crashes that people sent in by clicking the "Send Error Report" button in the crash dialog. And there were huge numbers of them that made no sense whatsoever. For example, there would be code sequences like this: Yet when we looked at the error report, the ecx and eax registers were equal! ...
Comments are closed.0Other

The end of one of the oldest computers at Microsoft still doing useful work

My building was scheduled for a carpet replacement—in all my years at Microsoft, I think this is the first time this has ever happened to a building I was in—so we all had to pack up our things so the carpeters could get clear access to the floor. You go through all the pain of an office move (packing all your things) but don't get...