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

Mar 8, 2013
0
0

Microsoft-internal Chuck Norris facts

Raymond Chen
Raymond Chen

A colleague of mine forwarded me some status mail from his team's internal bug push. (This is a push to fix bugs, not a push to introduce new bugs.) Apparently, one of the ways the developers lifted the tension was to discover some new Chuck Norris Facts, two of which were shared in the status mail: Chuck facts today: Happy birthday, Chuc...

Non-Computer
Mar 8, 2013
0
0

Why do Explorer and the command prompt interpret file times differently?

Raymond Chen
Raymond Chen

A customer observed that if they use Explorer to view the timestamp on a file, it is not always in agreement with the value shown if they run a plain in a command prompt. They are sometimes off by an hour. Why is that? Whenever you hear the phrase "off by an hour" you should immediately think "Daylight Saving Time". The formatting of file tim...

Tips/SupportTime
Mar 7, 2013
0
0

What are the conventions for managing standard handles?

Raymond Chen
Raymond Chen

Consider this function: void ChangeConsoleColor(WORD wColor) { HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); if (h != INVALID_HANDLE_VALUE) { SetConsoleTextAttribute(h, wColor); CloseHandle(h); } } "When I call this function, it works the first time, but when I call it a second time, Get­Std­Handle returns a handle numerically ide...

Code
Mar 6, 2013
0
0

What are the dire consequences of not selecting objects out of my DC?

Raymond Chen
Raymond Chen

The convention when working with device contexts is to restore them to the way you found them. If a drawing function selects a bitmap into a device context, then it should select the original bitmap into the device context before returning. Same for fonts, pens, all that stuff. But what if you decide to violate that convention? For example, maybe...

Code
Mar 5, 2013
0
0

Space Mountain as if the lights were on, and other Disneyland/World secrets

Raymond Chen
Raymond Chen

Many years ago, some friends of mine went to Disneyland and got to experience Space Mountain in an unusual way. They went through the ride the normal way, but when the car returned to the load/unload area, the cast member (because that's what Disney calls them) asked, "Do you want to go again?" Everybody in the car enthusiastically shouted, "...

Non-Computer
Mar 5, 2013
0
0

Inadvertently creating dress-like-Steve day

Raymond Chen
Raymond Chen

Even if you haven't been paying much attention, you may have noticed that Steve Sinofsky has developed a bit of a uniform for himself. You can pretty much count on him wearing a T-shirt with a V-neck sweater. (There appears to be some sort of alphabetic theme there, but I'm not going to check if he's also wearing a G-string.) Some time ago, I rea...

Non-Computer
Mar 4, 2013
0
0

Around and around and back and somewhere else

Raymond Chen
Raymond Chen

I dreamed that I was navigating through an enormous house, with lots of twists and turns. I eventually became convinced that the house was only locally Euclidean. Yes, I sometimes have topology dreams.

Non-ComputerDream
Mar 4, 2013
0
0

Marking a shortcut to say that it should not be placed on the Windows 8 Start page upon installation or treated as a newly-installed application

Raymond Chen
Raymond Chen

Today's Little Program creates a shortcut on the Start menu but marks it as "Do not put me on the front page upon installation." This is something you should do to any secondary shortcuts your installer creates. And while you're at it, you may as well set the "Don't highlight me as a newly-installed program" attribute used by Windows 7. (Reme...

Code
Mar 1, 2013
0
1

The source of much confusion: “backed by the system paging file”

Raymond Chen
Raymond Chen

Perhaps one of the most misunderstood sentences in the Win32 documentation is this little bit in the documentation for : If hFile is INVALID_HANDLE_VALUE, the calling process must also specify a size for the file mapping object in the dwMaximum­Size­High and dwMaximum­Size­Low parameters. In this scenario, Create­File­Map...

Code