The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts

How do I launch a file as if it were a text file, even though its extension is not .txt?

You might have a program that generates log files or other text content with an extension other than . You naturally might want to open these documents in the user's default text editor. You might decide to ask the Windows developer support team, "How can I figure out what program is the handler for text files?" The idea being that once you get this program name, you can then run it yourself, with the document on the command line. And you would also be running into the trap of looking for the answer to a question rather than a solution to a problem. For one thing, the default handler for the file type might ...

What’s the story of the onestop.mid file in the Media directory?

If you look in your folder, you'll find a MIDI file called . What's the story behind this odd little MIDI file? Aaron Margosis considers this file a security risk because "if an attacker can cause that file to be played, it will cause lasting mental pain and anguish to everybody within earshot." Despite Wikipedia's claims[citation needed], the file is not an Easter Egg. The file was added in in Windows XP with the comment "Add cool MIDI files to replace bad old ones." So as bad as is, the old ones must have been even worse! Okay, but why were they added? For product support. The product support...

Let me take this shortcut across Lake Saskatchewan

I dreamed that I had to drive from Los Angeles to Berkeley to catch my flight home. To do this, I used a product from a local startup company: A computerized map of the Bay Area. There were two routes across Lake Saskatchewan. The southern route is highway I-70, and the northern route is an elevated highway that goes right past the head of the Canadian Statue of Freedom, a 300-foot-tall statue carved from a single rock. This shows that computer nerds are horrible cartographers: Berkeley has an airport, Los Angeles is on the peninsula just south of San Francisco, and the Bay Area is in Canada. Sure, this is ...

Display an overlay on the taskbar button

Today's "Little Program" displays an overlay on the taskbar button. I've seen some people call this a "badge", but "overlay" is the official term. Start with our scratch program and make the following changes: #include <comip.h> #include <comdef.h> #include <shlobj.h> #include <shellapi.h> _COM_SMARTPTR_TYPEDEF(ITaskbarList3, __uuidof(ITaskbarList3)); I decided to shake things up and use a different smart pointer library: com_ptr_t. (That'll teach you to complain that I don't use a smart pointer library in my samples. Now you get to complain that I use the wrong smart pointer libr...

The Essential Guide To Dim Sum

The folks over at BuzzFeed Food have put together this marvelous Essential Guide To Dim Sum. The field guide includes pictures of dim sum offerings, organized by food preparation style, then sub-categorized by physical appearance. Each dish is accompanied by its name in three languages (English, Mandarin Chinese, and Cantonese), along with symbolic information similar to a clothing care tag that encodes information like recommended method of eating. Save some radish cakes for me. Via Tony Chor.

For the Nitpickers: Enhanced-mode Windows 3.0 didn’t exactly run a copy of standard-mode Windows inside the virtual machine

Generally speaking, Enhanced-mode Windows 3.0 ran a copy of standard-mode Windows inside the virtual machine. This statement isn't exactly true, but it's true enough. Commenter Nitpicker objected, "Why are you threatening us with the Nitpicker's Corner for asking about this issue instead of explaining it once and linking it everywhere?" Okay, first of all, as far as I can tell, you're the first person to ask about the issue. So you can't say "Everybody who asks about the issue is threatened with the Nitpicker's Corner" because up until you made your comment, nobody ever asked. Okay, well, technically you c...

Once you know something can be done, doing it is much easier

Unfortunately, I don't remember the name of the star of this story, but I'm told that there was a notable mathematician who believed the Perfect Graph Conjecture to be false and spent many years trying to prove it one way or another. Meanwhile, another mathematician (presumably László Lovász) announced that he had found a proof (in the affirmative). Upon hearing the news that the open question had been resolved, the first mathematician was able to produce a proof within 90 minutes. Once again showing that it's much easier to do something once you know it can be done.

How can I register my context menu command for all file types *except* one, or other complex conditionals?

Advanced Query Syntax to the rescue.

The curious pattern of pre-emptively rejecting the solution to your problem

A frustrating pattern that shows up occasionally in customer questions is the case where the customer poses a problem, and pre-emptively rejects the mechanism explicitly designed to solve that problem. How can we change the widget color without using IWidget::SetColor? Um, the whole point of IWidget::SetColor is to change the color of a widget. Why are you rejecting the mechanism whose sole purpose in life is to solve the very problem you are having? Usually, if you press hard enough, they will cough up the reason why they think they cannot use the solution specifically designed to do what they w...