What is this extra thread in my process?
A customer liaison asked: After applying Service Pack 2 to Windows Server 2003, my customer found that a simple MFC application (just using the template, no customization) has two threads when it is...
View ArticleThe heavy metal umlaut encroaches into Seattle real estate
The heavy metal umlaut is creeping into Seattle real estate. I submit for your consideration the condominium known as Bleü. I can't even tell what language they are trying to pretend to be. There are...
View ArticleWhen something gets added to a queue, it takes time for it to come out the...
A customer wanted to know why the input they were simulating with SendInput is not being reported by GetAsyncKeyState. Isn't that supposed to reflect the instantaneous keyboard state? I just...
View ArticleDebugging: Diagnosing why malloc is failing
A customer had some code which was experiencing memory allocation failures when calling malloc (which maps to HeapAlloc). The function returns nullptr, and GetLastError() reports...
View ArticleWhen someone proposes marriage, bear in mind that there is a question that...
A colleague of mine was at a restaurant, and he spotted a young couple at the next table. The woman fawned over a classic diamond engagement ring, and when she put it on her finger, he decided that it...
View ArticleWriting automation to wait for a window to be created (and dismiss it)
Today's Little Program uses UI Automation to cancel the Run dialog whenever it appears. Why? Well, it's not really useful in and of itself, but it at least provides an example of using UI Automation...
View ArticleThe Grand Duke's monocle is an affectation
In the Disney adaptation of Cinderella, the Grand Duke wears a monocle. The monocle moves from eye to eye during the course of the story. The Grand Duke's monocle is an affectation. Either that, or he...
View ArticleIf you cancel an operation while it's in progress, then it's not surprising...
A customer (via their customer liaison) started by asking why they were seeing an unexpected access control entry in the security descriptor of an object. The ACEs on the parent grant access to...
View ArticleWhen will the static control automatically delete the image loaded into it,...
If you create a static control with initial contents (for example, by creating a BITMAP or ICON control in a dialog template), then the static control will load the contents upon creation and destroy...
View ArticleWhat is the programmatic equivalent to unchecking the box to prevent a file...
A customer wanted to know how they could write a program that automatically checked and unchecked the box that appears on a file's property sheet on the General tab, clicking the Advanced button, and...
View ArticleHow can I make sure my program is launched only from my helper program and no...
Say you have a collection of programs which work together. One of them is the "master" program that runs the show, and it has a bunch of "assistant" programs that it launches to accomplish various...
View ArticleLogging the contents of every message box dialog via automation
Today's Little Program logs the contents of every message box dialog, or anything that vaguely resembles a message box dialog. (Since there's no way for sure to know whether a dialog box is a message...
View ArticleNieces sometimes extrapolate from insufficient contextual data
My brother-in-law enjoys greeting his nieces when they come over to visit by throwing them into the air and asking, "叫聲我?" (Who am I?) The nieces happily reply, "舅舅." (Uncle.) He then tosses them up...
View ArticleA simple email introduction: Fan mail
One of my former colleagues on the Windows kernel team wasn't afraid to make changes all across the system when necessary. If the engineering team decided to upgrade to a new version of the C++...
View ArticleWhy are leading digits converted to language-specific digit shapes, but not...
If you have a string like 12345ABCDE67890, and you render it on an Arabic system, you might get ٠١٢٣٤ABCDE67890. The leading digits are rendered as Arabic-Indic digits, but the trailing digits are...
View ArticleWhat does the SEE_MASK_UNICODE flag in ShellExecuteEx actually do?
Somebody with a rude name wonders what the SEE_MASK_UNICODE flag does. It does nothing. The flag was introduced when porting the Windows 95 shell to Windows NT. It happened further back in history...
View ArticleHow can I detect that my program was run from Task Scheduler, or my custom...
Suppose you want your program to behave differently depending on whether it is launched from the Start menu, or by clicking the pinned icon on the taskbar, or by Scheduled Task, or from a service, or...
View ArticleAdventures in automation: Dismissing all message boxes from a particular...
Suppose you have a program that is part of your workflow, and it has the annoying habit of showing a message box when it is finished. You want to automate this workflow, and part of that automation is...
View ArticleWhat two-year-olds think about when they are placed in time-out
My niece (two years old at the time) was put in the corner as punishment for some sort of misdeed. At the expiration of her punishment, her grandfather returned and asked her, "你乖唔乖?" (Are you going...
View ArticleWhat order does the DIR command arrange files if no sort order is specified?
If you don't specify a sort order, then the DIR command lists the files in the order that the files are returned by the FindFirstFile function. Um, okay, but that just pushes the question to the...
View Article