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 ArticleWe'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 ArticleConverting 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 FILETIME; the bottom row is labeled SYSTEMTIME. The first column is labeled UTC; the second column is...
View ArticleProgrammatically 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 ArticleWhy 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 ArticleHow 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 ArticleOn 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 ArticleOperations 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 ArticleWhy does the Directory.GetFiles method sometimes ignore *.html files when I...
The documentation for the Directory.GetFiles method says When using the asterisk wildcard character in a searchPattern, such as "*.txt", the matching behavior when the extension is exactly three...
View ArticleHow do I create an IShellItemArray from a bunch of file paths?
The IFileOperation interface accepts bulk operations in the form of an IShellItemArray. So how do you take a list of file names and convert them into an IShellItemArray? There is no...
View ArticleHow 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 ArticleWhy 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 ArticleRaymond'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 ArticleI 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 ArticleGoing for the facts: Who is displaying this message box?
A customer wanted to know whether CreateProcess had a problem with Unicode. A problem with it? Quite the contrary. CreateProcessloves Unicode! In fact, if you call the ANSI version, it converts the...
View ArticleWhen 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 ArticleWhy can't I __declspec(dllexport) a function from a static library?
A customer was having trouble exporting a function with the __declspec(dllexport) declaration specified, but found that if the function was in a static library, no function was exported. Why is...
View ArticleDifferent 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 ArticleEnumerating 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 ArticleGeeky 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