Showing results for July 2013 - Page 2 of 3 - The Old New Thing

Jul 22, 2013
0
0

A program for my nieces: The ABCs, part 3

Raymond Chen
Raymond Chen

One problem I discovered when my nieces ran my initial ABC program was that they had a habit of holding down a key, thereby triggering autorepeat. I had instructed them not to mash the keyboard but rather to press only one key at a time, and while they were good at adhering to the "one key at a time" rule, they also interpreted it as "type really...

Code
Jul 19, 2013
0
0

Nasty gotcha: STGM_READ | STGM_WRITE does not grant read/write access

Raymond Chen
Raymond Chen

You might think that if you want to get read/write access, you could pass . You would be wrong. You have to pass . The three flags , , and are mutually exclusive. If you try to combine them, you get a weird mess. In particular, since the numerical value of is zero, passing is numerically equivalent to passing , which grants write-only access...

Code
Jul 17, 2013
0
0

Why is LOCALE_SDURATION so dorky-looking?

Raymond Chen
Raymond Chen

For formatting time spans, you can use the format string, but the result is a dorky format. Why isn't there a format that is fancier like ? You have the complexities of natural language to thank. In the general case, there is not enough information to provide the appropriate grammatical context in order to know the correct format. This isn't a...

Other
Jul 16, 2013
0
0

Microspeak: Landing, especially the heated kind

Raymond Chen
Raymond Chen

Work on Windows occurs in several different branches of the source code, and changes in one branch propagate to other branches. When talking about a feature or other task becoming visible in a branch, the preferred jargon word at Microsoft is landing. In its purest form: We expect the feature to land in the trunk early next week. The term land...

OtherMicrospeak
Jul 15, 2013
0
0

Watch out for those out-of-control Canadian tour buses

Raymond Chen
Raymond Chen

I don't remember the details, but I dreamed about a bunch of things, including careening through Canada on a tour bus trying to catch a ferry while people worried about their cell phone roaming charges, an episode of Friends shot in the style of ER, and one of my friends in an orange jumpsuit sneaking around...

Non-ComputerDream
Jul 15, 2013
0
0

A program for my nieces: The ABCs, part 2, choosing a font

Raymond Chen
Raymond Chen

I added a feature to my ABC program that it turns out I never actually used: Change the font. I added this in case my nieces were somehow unhappy with the font I chose, and this was a little escape hatch to let me select a different one. The real work happens in the function. All I have to do is call it. I tell the common font dialog to ...

Code
Jul 12, 2013
0
0

If you want to track whether the current thread owns a critical section, you can use the critical section itself to protect it

Raymond Chen
Raymond Chen

You may find yourself in the situation where you want to keep track of the owner of a critical section. This is usually for debugging or diagnostic purposes. For example, a particular function may have as a prerequisite that a particular critical section is held, and you want to assert this so that you can catch the problem when running the debug ...

Code
Jul 11, 2013
0
0

Where is this CRC that is allegedly invalid on my hard drive?

Raymond Chen
Raymond Chen

If you're unlucky, your I/O operation will fail with , whose description is "Data error (cyclic redundancy check)." Where does NTFS keep this CRC, what is it checking, and how can you access the value to try to repair the data? Actually, NTFS does none of that stuff. The CRC error you're getting is coming from the hard drive itself. Hard drives ...

Other
Jul 10, 2013
0
0

Why is the syntax for touching a file from the command prompt so strange?

Raymond Chen
Raymond Chen

The magic incantation for updating the last-modified date on a file is What strange syntax! What's with the plus sign and the commas, anyway? The formal syntax is the much more straightforward This means to start with the file , then append the files , , and , treating them all as binary files. If you omit the part, then you get ...

History