Showing archive results for 2014

Jun 24, 2014
Post comments count0
Post likes count0

The social interactions in two preschool classes, in graphic form

Raymond Chen

Each preschooler at my daughter's school was asked a few simple questions, and the answers were printed in the yearbook. Among other things, the preschoolers were asked to complete the sentence, "I like to play with (person)." This is the type of question that leads to tears and hurt feelings. Whatever. Their parents are going to be stuck with th...

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

Finding the "Run as administrator" command, a game of hide-and-seek

Raymond Chen

Back in the old days, the "Run as administrator" menu option was placed on the extended menu. To get the extended menu, you hold the shift key when you right-click on the shortcut. In Windows 7, the "Run as administrator" option was moved to the primary menu, so you no longer need to hold the shift key to get it. Well, except that sometimes ...

Tips/Support
Jun 23, 2014
Post comments count0
Post likes count1

Adding a sound to the Alt+Tab window

Raymond Chen

Today's Little Program plays a sound when the Alt+Tab window appears and disappears. The program registers an accessibility event hook for the and events. The Start event fires when an Alt+Tab operation begins, and the End event fires when an Alt+Tab operation completes. As noted in the documentation, you can get spurious End events, so we k...

Code
Jun 20, 2014
Post comments count0
Post likes count1

Once you go input-idle, your application is deemed ready to receive DDE messages

Raymond Chen

Feel free to stop using DDE. There was one customer who confessed that they were still using DDE, and they asked for help debugging a DDE problem. They found that sometimes, when their application was launched for DDE, it never received the message. Instead, the function returned . If launched from Explorer, the error message shown to the user ...

Code
Jun 19, 2014
Post comments count0
Post likes count1

What happened to the Shut Down menu in classic Task Manager?

Raymond Chen

The great thing about open comments is that anybody can use them to introduce their favorite gripe as long as it shares at least four letters of the alphabet in common with the putative topic of the base article. xpclient "asks" why the Shut Down menu was removed from Task Manager. I put the word "asks" in quotation marks, because it's really a ...

History
Jun 18, 2014
Post comments count0
Post likes count1

10 is the new 6

Raymond Chen

While it may no longer be true that everything at Microsoft is built using various flavors of Visual C++ 5.0, 6.0, and 7.0, there is still a kernel of truth in it: A lot of customers are still using Visual C++ 6.0. That's why the unofficial slogan for Visual C++ 2010 was 10 is the new 6. Everybody on the team got a T-shirt with the slogan (beca...

History
Jun 17, 2014
Post comments count0
Post likes count1

Who would ever write a multi-threaded GUI program?

Raymond Chen

During the development of Windows 95, the user interface team discovered that a component provided by another team didn't work well under multi-threaded conditions. It was documented that the function had to be the first call made by a thread into the component. The user interface team discovered that if one thread called , and then used the...

History
Jun 16, 2014
Post comments count0
Post likes count1

Enumerating bit strings with a specific number of bits set (binomial coefficients strike again)

Raymond Chen

Today's Little Program prints all bit strings of length n subject to the requirement that the string have exactly k 1-bits. For example, all bit strings of length 4 with 2 bits set are 0011, 0101, 0110, 1001, 1010, and 1100. Let's write BitString(n, k) to mean all the bit strings of length n with exactly k bits set. Let's look at the last b...

Code
Jun 13, 2014
Post comments count0
Post likes count1

Non-classical processor behavior: How doing something can be faster than not doing it

Raymond Chen

Consider the following program: The program generates a lot of random integers in the range 0..9 and then counts how many are less than 0, less than 1, less than 2, and so on. It also prints how long the operation took in QPC units. We don't really care how big a QPC unit is; we're just interested in the relative values. (We print the number of...

Code
Jun 12, 2014
Post comments count0
Post likes count1

Can we continue to call FindNextFile() with the same handle that returned an error last time?

Raymond Chen

A customer wanted to know whether it was okay to call with the same handle that returned an error last time. In other words, consider the following sequence of events: The customer elaborated: Suppose that the directory contains four files, A, B, C, and D. We expect the following: After returns an error, can we continue to search with th...

Code