Showing archive results for 2014

Feb 25, 2014
Post comments count0
Post likes count1

A simple email introduction: Fan mail

Raymond Chen

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++ compiler, my colleague was the one who gave it a test-drive on the entire Windows source code, and fixed all the warnings and errors that kick up as well as...

Non-Computer
Feb 24, 2014
Post comments count0
Post likes count1

Nieces sometimes extrapolate from insufficient contextual data

Raymond Chen

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 into the air a second time and says, "大聲啲!" (Louder!) And the nieces happily shout, "舅...

Non-Computer
Feb 24, 2014
Post comments count0
Post likes count1

Logging the contents of every message box dialog via automation

Raymond Chen

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 box or not.) This is the same pattern as the program we wrote last week, but with different guts when the window opens. This time, we see if the...

Code
Feb 21, 2014
Post comments count0
Post likes count1

How can I make sure my program is launched only from my helper program and no other parent?

Raymond Chen

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 subtasks. These assistants are not meant to be run by themselves; they are meant to be run only by the master program. How do you design the assistant so...

Code
Feb 20, 2014
Post comments count0
Post likes count1

What is the programmatic equivalent to unchecking the box to prevent a file from having its contents indexed?

Raymond Chen

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 then checking or unchecking the item whose name keeps changing: The checkbox maps to the file attribute formally known as , and informally known as...

Code
Feb 19, 2014
Post comments count0
Post likes count1

When will the static control automatically delete the image loaded into it, and when is it the responsibility of the application?

Raymond Chen

If you create a static control with initial contents (for example, by creating a or control in a dialog template), then the static control will load the contents upon creation and destroy the contents upon destruction. So at least in the case where you don't touch the static control, things will work automatically. But once you touch it, thing...

Code
Feb 18, 2014
Post comments count0
Post likes count1

If you cancel an operation while it's in progress, then it's not surprising that it's only half-done

Raymond Chen

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 Administrators, CREATOR OWNER, SYSTEM, and Users, but the ACEs on the child object (which should simply have been inherited from the parent) include an ext...

Tips/Support
Feb 17, 2014
Post comments count0
Post likes count1

The Grand Duke's monocle is an affectation

Raymond Chen

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 needs a full pair of glasses, but is very frugal.

Non-Computer
Feb 17, 2014
Post comments count0
Post likes count1

Writing automation to wait for a window to be created (and dismiss it)

Raymond Chen

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 to wait for an event to occur and then respond to it. Okay, let's see what's going on here. The program registers a delegate with UI automation w...

Code
Feb 14, 2014
Post comments count0
Post likes count1

When someone proposes marriage, bear in mind that there is a question that needs to be answered

Raymond Chen

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 was safe to ask them about it. They had gotten engaged earlier that day, and the man told the story of the proposal, up to the point where he asked ...

Non-Computer