Quantcast
Channel: The Old New Thing
Browsing all 3085 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Why do I have to add 1 to the color index when I set it as the hbrBackground...

Our scratch program sets the background color to COLOR_WINDOW by setting the class background brush as follows: wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); What's with the +1? Okay, first of all,...

View Article


Image may be NSFW.
Clik here to view.

We're currently using FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH, but...

A customer said that their program's I/O pattern is to open a file and then every so often write about 100KB of data into the file. They are currently using the FILE_FLAG_NO_BUFFERING and...

View Article


Image may be NSFW.
Clik here to view.

Converting from a UTC-based SYSTEMTIME directly to a local-time-based SYSTEMTIME

Last year, I presented this commutative diagram A 2-by-2 grid of boxes. The top row is labeled FILE­TIME; the bottom row is labeled SYSTEM­TIME. The first column is labeled UTC; the second column is...

View Article

Image may be NSFW.
Clik here to view.

Programmatically uploading a file to an FTP site

Today's Little Program uploads a file to an FTP site in binary mode with the assistance of the Wininet library. This program has sat in my bag of tools for years. #define STRICT #define UNICODE...

View Article

Image may be NSFW.
Clik here to view.

Why Johnny can't read music

In the book He Bear, She Bear, the musical instrument identified as a tuba is clearly a sousaphone. (For those who are wondering what the title has to do with the topic of musical instrument...

View Article


Image may be NSFW.
Clik here to view.

How do I disable zone markers for downloaded files, so that Explorer stops...

My Little Program about manipulating the zone identifier for downloaded files appears to have struke a nerve with commenter Tess, who launched into some sort of diatribe about how Microsoft should...

View Article

Image may be NSFW.
Clik here to view.

On live performances of Star Trek

Spock's Brain is generally considered to be the worst episode of Star Trek. That may be why in 2009 Mike Carano decided to perform it as a theatrical production. Here is the opening scene, and here's...

View Article

Image may be NSFW.
Clik here to view.

Operations jargon: Internet egress

As I've noted before, the operations team has their own jargon which superficially resembles English. Some time ago, they sent out a message with the subject A New Internet Egress Path Is Coming....

View Article


Image may be NSFW.
Clik here to view.

Why does the Directory.GetFiles method sometimes ignore *.html files when I...

The documentation for the Directory.Get­Files method says When using the asterisk wildcard character in a search­Pattern, such as "*.txt", the matching behavior when the extension is exactly three...

View Article


Image may be NSFW.
Clik here to view.

How do I create an IShellItemArray from a bunch of file paths?

The IFile­Operation interface accepts bulk operations in the form of an IShell­Item­Array. So how do you take a list of file names and convert them into an IShell­Item­Array? There is no...

View Article

Image may be NSFW.
Clik here to view.

How do I show the contents of a directory while respecting the user's...

A customer was writing a program in (and this is what they said) "32 bit C++ .Net 4.0" which displayed the contents of a directory, and they wanted to filter out items such as hidden files and...

View Article

Image may be NSFW.
Clik here to view.

Why do I have to hit an arrow key before a keyboard-initiated Move operation...

TehShrike wonders why you have to hit an arrow key before a keyboard-initiated Move operation will follow the mouse. I don't know, but I think it's just a bug. Mind you, it's a bug with extraordinary...

View Article

Image may be NSFW.
Clik here to view.

Raymond's highly scientific predictions for the 2014 NCAA men's basketball...

Once again, it's time for Raymond to come up with an absurd, arbitrary criterion for filling out his NCAA bracket. This year, I look at the number of followers of of the basketball team's official...

View Article


Image may be NSFW.
Clik here to view.

I think this person's monitor is broken: It doesn't know how to render text...

Some time ago, somebody asked a question about why, when they do 1 and 2, they get extra thing 3. "The extra 3 is there because of the 456 feature. BUT DO NOT DISABLE THE 456 FEATURE JUST BECAUSE YOU...

View Article

Image may be NSFW.
Clik here to view.

Going for the facts: Who is displaying this message box?

A customer wanted to know whether Create­Process had a problem with Unicode. A problem with it? Quite the contrary. Create­Processloves Unicode! In fact, if you call the ANSI version, it converts the...

View Article


Image may be NSFW.
Clik here to view.

When visitors to the United States underestimate the size of the country

A friend of mine who is from Lebanon (but now lives in Seattle) invited his grandmother to come visit for the summer. When she arrived, he asked her, "Grandma, is there anywhere in particular you...

View Article

Image may be NSFW.
Clik here to view.

Why can't I __declspec(dllexport) a function from a static library?

A customer was having trouble exporting a function with the __decl­spec(dll­export) declaration specified, but found that if the function was in a static library, no function was exported. Why is...

View Article


Image may be NSFW.
Clik here to view.

Different senses of scale create different travel expectations

A friend of mine had a business meeting near London, and he decided to extend it to a tour of Scotland and England once the meetings were over. (This is the same friend who took me on the emergency...

View Article

Image may be NSFW.
Clik here to view.

Enumerating set partitions with Bell numbers and Stirling numbers of the...

Just for fun, today's Little Program is going to generate set partitions. (Why? Because back in 2005, somebody asked about it on an informal mailing list, suggesting it would be an interesting puzzle,...

View Article

Image may be NSFW.
Clik here to view.

Geeky t-shirt alert: Windows 7's so-called God Mode

Back in 2010, the so-called God Mode was the hit discovery of the Internet, at least until the next cute cat video made the rounds. If you had stopped by the Microsoft Visitor Center during that...

View Article
Browsing all 3085 articles
Browse latest View live