Showing archive results for 2012

Jun 26, 2012
Post comments count0
Post likes count1

Thanks for reminding me what to do when the elevator is out of order

Raymond Chen

Every few years, the building maintenance people have to perform tests on the elevators to ensure they meet safety regulations. And the real estate department sends out the usual notice informing the building occupants that the elevators in the building will be taken out of service at various times during the day. They were kind enough to include...

Non-Computer
Jun 25, 2012
Post comments count0
Post likes count1

How does Explorer determine the delay between clicking on an item and initiating an edit?

Raymond Chen

Ian Boyd wants to know why the specific value of 500ms was chosen as the edit delay in Windows Explorer. Because it's your double-click time. Since the double-click action (execute) is not an extension of the single-click action (edit), Explorer (and more generally, list view) waits for the double-click timeout before entering edit mode so it c...

Tips/Support
Jun 22, 2012
Post comments count0
Post likes count2

How did real-mode Windows fix up jumps to functions that got discarded?

Raymond Chen

In a discussion of how real-mode Windows walked stacks, commenter Matt wonders about fixing jumps in the rest of the code to the discarded functions. I noted in the original article that "there are multiple parts to the solution" and that stack-walking was just one piece. Today, we'll look at another piece: Inter-segment fixups. Recall that ...

History
Jun 21, 2012
Post comments count0
Post likes count1

When the default pushbutton is invoked, the invoke goes to the top-level dialog

Raymond Chen

One quirk of nested dialogs lies in what happens when the user presses Enter to invoke the default pushbutton: The resulting message goes to the top-level dialog, even if the default pushbutton belongs to a sub-dialog. Why doesn't it send the to the parent of the default pushbutton? I mean, the dialog manager knows the handle of the button, so...

Code
Jun 20, 2012
Post comments count0
Post likes count0

Counting down to the last day of school, as students do it

Raymond Chen

Today is the last day of school in Seattle public school. My friend the seventh-grade teacher told me that students count down to the last day of school in a rather unusual way. Some people might count the number of calendar days until the end of school. For example, if there are 35 days between today and the last day of school, we say that it's 3...

Non-Computer
Jun 20, 2012
Post comments count0
Post likes count2

When embedding a dialog inside another, make sure you don't accidentally create duplicate control IDs

Raymond Chen

The extended style (known in dialog templates as ) instructs the dialog manager that the dialog's children should be promoted into the dialog's parent. This is easier to explain in pictures than in text. Given the following window hierarchy: The result of the extended style being set is that the children of B are treated as if they were di...

Code
Jun 19, 2012
Post comments count0
Post likes count1

It's not a good idea to give multiple controls on a dialog box the same ID

Raymond Chen

When you build a dialog, either from a template or by explicitly calling , one of the pieces of information about each control is a child window identifier. And it's probably in your best interest to make sure two controls on the dialog don't have the same ID number. Of course, one consequence of giving two control the same ID number is that the ...

Code
Jun 18, 2012
Post comments count0
Post likes count1

What is the history of the GetRandomRgn function?

Raymond Chen

An anonymous commenter was curious about how the function arrived at its strange name, what the purpose of the third parameter is, and why it is inconsistent between Windows 95 and Windows NT. The sense of word "random" here is hacker slang rather than its formal probabilistic definition, specifically sense 2: "Assorted, undistin...

History
Jun 15, 2012
Post comments count0
Post likes count0

Globalization quiz: In honor of, well, that's part of the quiz

Raymond Chen

The Corporate Citizenship Tools; Microsoft Local Language Program Web site contains a map of the world, coded by region. There was a bug on the map. See if you can spot it: After I pointed out the error, they fixed the map on their Web page, so no fair clicking through to the Local Language Program Web page and comparing the pictures! Non-use...

Other
Jun 14, 2012
Post comments count0
Post likes count1

Now that Windows makes it harder for your program to block shutdown, how do you block shutdown?

Raymond Chen

Up until Windows XP, applications could intercept the message and tell Windows, "No, don't shut down." If they were polite about it, they would also inform the user which application blocked system shutdown and why. And if they were really polite about it, they would even provide a way for the user to say, "I don't care; shut down anyway." A...

Code