Showing results for November 2003 - Page 2 of 3 - The Old New Thing

Nov 18, 2003
0
0

Make sure the buttons match the question

Raymond Chen
Raymond Chen

When your program displays a dialog box with buttons, please make the buttons match the text. Consider this dialog, which appears after you install patches from Windows Update: It asks a yes/no question, but the options are "OK" and "Cancel". Either the buttons should be ...

Code
Nov 17, 2003
0
0

Another favorite from the Grauniad

Raymond Chen
Raymond Chen

The world: a primer Great Britain Small American dependency located approximately 5,000 miles outside Galveston, Texas...

Non-Computer
Nov 17, 2003
0
1

More stories of bad hardware

Raymond Chen
Raymond Chen

My favorite bad CD-ROM drive from Windows 95 was one where the manufacturer cut a corner to save probably twenty-five cents. The specification for CD-ROM controllers indicates that each can host up to four CD-ROM drives. When you talk to the card, you specify which drive you wish to communicate with. The manufacturer of a certain brand of ...

History
Nov 17, 2003
0
0

Stay healthy: Drink Guinness

Raymond Chen
Raymond Chen

Flavenoids in Guinness combat fatty deposits in arteries. Note, however that the beer was consumed by being "fed ... via tubes directly into their stomachs." On the other hand, a friend of mine points out, "I thought a tube leading directly to the stomach was also called the esophagus. That's my Guinness ...

Non-Computer
Nov 14, 2003
0
0

Preventing edit control text from being autoselected in a dialog box

Raymond Chen
Raymond Chen

By default, when the user TABs to an edit control in a dialog box, the entire contents of the edit control are autoselected. This occurs because the edit control responds with the flag in response to the message. To prevent it from happening, remove that flag. All this subclass procedure does is remove the flag from the return value of the ...

Code
Nov 13, 2003
0
0

British newspapers are much more fun to read

Raymond Chen
Raymond Chen

You can always count on The Register for a snarky take on the day's technology news. Today's favorite is this "review" of the nTAG, which ends with Well, we think that any sane person would have to held at gunpoint to induce them to carry an electronic device which, besides containing personal or ...

Non-Computer
Nov 13, 2003
0
0

Another different type of dialog procedure

Raymond Chen
Raymond Chen

The other method of using a window-procedure-like dialog box is to change the rules of the game. Normally, the window procedure for a dialog box is the function, which calls the dialog procedure and then takes action if the dialog procedure indicated that it desired the default action to take place. The dialog procedure is subservient to , ...

Code
Nov 13, 2003
0
0

Answer to previous exercise about m_fRecursing

Raymond Chen
Raymond Chen

Answer to previous exercise: The flag does not need to be per-instance. It only needs to be valid long enough that the recursive call that comes immediately afterwards can be detected. However, a global variable would not work because two threads might be inside the recursive call simultaneously. But a thread-local variable would work. (If you...

Code
Nov 12, 2003
0
0

A different type of dialog procedure

Raymond Chen
Raymond Chen

In the discussion following my entry about dialog procedure return values, somebody suggested an alternate dialog design where you just call to do default actions (the same way you write window procedures and ) rather than returning TRUE/FALSE. So let's do that. In fact, we're going to do it twice. I'll cover one method today and cover an ...

Code
Nov 11, 2003
0
0

Welcome Martyn Lovell

Raymond Chen
Raymond Chen

Martyn Lovell from the VC++ team has joined the world of blogging. Martyn is a smart guy, even though he does spell some words funny...

Other