The mystery of the icon that never appears
A customer reported a problem showing an icon on their dialog box. We verified that this code does execute during the handling of the WM_INITDIALOG message. No assertion fires, yet no icon appears...
View ArticleIs WriteProcessMemory atomic?
A customer asked, "Does WriteProcessMemory write the memory atomically? I mean, if I used WriteProcessMemory to write 10 instructions for a total of 20 bytes, can WriteProcessMemory wrote those...
View ArticleAn extensible interlocked arithmetic function (via lambdas)
Some time ago, I noted that you can build other interlocked operations out of InterlockedCompareExchange. Here's an example: using System.Threading; public static int InterlockedMax(ref int...
View ArticleCreating a simple shell item, just as fake as a simple pidl
Continuing from Creating a simple pidl: For the times you care enough to send the very fake: Instead of creating a simple pidl, we'll create a simple shell item. The idea is the same. We build a file...
View ArticleThe code names for various subprojects within Windows 95
Most people know that Windows 95 was code-named Chicago. The subprojects of Windows 95 also had their code names, in part because code names are cool, and in part because these projects were already...
View ArticleDialog boxes return focus to the control that had focus when you last...
When you switch away from a dialog box, and then switch back to the dialog box, focus returns to the control that had focus when you last left the dialog box. But if you have a window that manually...
View ArticleWhy does my radio button group selection get reset each time my window...
A customer reported (all incomplete information and red herrings preserved): We have an issue related to two radio buttons in a window. The code programmatically checks the second button by sending the...
View ArticleEventually, we may find out where notes eight through twelve came from
CBC Radio's Tom Allen investigates the origin of the opening four notes of the classic Star Trek theme. He traces it to the opening of Mahler's First Symphony, then further back to Brahms's Second...
View ArticleWhy is the debugger telling me I crashed because my DLL was unloaded, when I...
A customer was puzzled by what appeared to be contradictory information coming from the debugger. We have Windows Error Reporting failures that tell us that we are executing code in our DLL which has...
View ArticleFind the index of the smallest element in a JavaScript array
Today's Little Program isn't even a program. It's just a function. The problem statement is as follows: Given a nonempty JavaScript array of numbers, find the index of the smallest value. (If the...
View ArticleOnly senior executives can send email to the All Employees distribution list,...
Some time ago, a senior executive sent email to the All Employees distribution list at Microsoft announcing that a particular product was now available for dogfood. The message included a brief...
View ArticleCargo-cult registry settings and the people who swear by them
Two customers (so far) wanted to know how to increase the duration of taskbar balloon notifications on Windows Vista. (By the way, I gave the answer some time ago.) They claimed that on Windows XP,...
View ArticleHow to take down the entire Internet with this one weird trick, according to...
According to the television documentary Crisis which aired on NBC last Sunday, a cyberattack took over the entire Internet. Timecode 13:00: "Anything connected to the Internet. Banking systems, power...
View ArticleIt rather involved being on the other side of this airtight hatchway: Denial...
We received the following security vulnerability report: Windows is vulnerable to a denial of service attack that consumes 100% CPU. Use the following procedure to create a file that is enchanted by...
View ArticleGet your hex wrench ready, because here comes the Ikea bicycle
Ikea säljer elcyklar. Click through for two-image slide show. Ikea selling electric bicycles Forget furniture. Ikea is now launching, that's right, an electric bicycle.It goes under the name...
View ArticleWhy does GetFileVersionInfo map the whole image into memory instead of just...
Commenter acq responds (with expletive deleted), "the whole file is mapped into the process' memory only for version info that's certainly only a few kilobytes to be read?" Why not map only the parts...
View ArticleObtaining information about the user's wallpaper on multiple monitors
Today we're going to dump information about the user's wallpaper settings on multiple monitors. The idea is simple. You use the IDesktopWallpaper interface on the DesktopWallpaper object to get...
View ArticleAs long as your file names meet operating system requirements, you can use...
A customer had a question about the MSDN documentation on rules for legal file names: My employees keep naming documents with hyphens in the name. For example, they might name a file...
View ArticleWhy did it take so long for Windows to support a taskbar on more than one...
Mark wants to know why Windows has never supported having a taskbar on more than one monitor. (The question was asked before Windows 8 multi-monitor taskbar support became publically-known.) The...
View ArticleClosing over the loop variable is just as harmful in JavaScript as it is in...
Prerequisite reading: Closing over the loop variable considered harmful. JavaScript has the same problem. Consider: function hookupevents() { for (var i = 0; i < 4; i++) {...
View Article