Quantcast
Channel: The Old New Thing
Browsing all 3085 articles
Browse latest View live
↧

Image may be NSFW.
Clik here to view.

What does -1.#IND mean?: A survey of how the Visual C runtime library prints...

As every computer scientist knows, the IEEE floating point format reserves a number of representations for infinity and non-numeric values (collectively known as NaN, short for not a number). If you...

View Article


Image may be NSFW.
Clik here to view.

Isn't the CompletionKey parameter to CreateIoCompletionPort superfluous?

When you associate a file handle with an I/O completion port with the Create­Io­Completion­Port function, you can pass an arbitrary pointer-sized integer called the Completion­Key which will be...

View Article


Image may be NSFW.
Clik here to view.

Now that version 4 of the .NET Framework supports in-process side-by-side...

Many years ago, I wrote, "Do not write in-process shell extensions in managed code." Since I originally wrote that article, version 4 of the .NET Framework was released, and one of the features of...

View Article

Image may be NSFW.
Clik here to view.

Display a custom thumbnail for your application (and while you're at it, a...

By default, when the taskbar or any other application wants to display a thumbnail for a window, the result is a copy of the window contents shrunk down to the requested size. Today we're going to...

View Article

Image may be NSFW.
Clik here to view.

Dreaming up strange inventions: The combination urinal/bidet/washing machine

I dreamed that a friend of mine was showing me her new appliance: A combination urinal/bidet/washing machine. As we loaded clothes into it, she said, "You okay in there, Stephanie?" A muffled voice...

View Article


Image may be NSFW.
Clik here to view.

This code would be a lot faster if it weren't for the synchronization

This is a story from a friend of a friend, which makes it probably untrue, but I still like the story. One of my colleagues jokingly suggested that we could speed up our code by adding these lines to...

View Article

Image may be NSFW.
Clik here to view.

When the option becomes so second-nature you forget that it's an option

A user of the imaginary Program Q program wanted to write an automated test that created a table, then ran various sub-test which communicated among each other by updating that table. When my test...

View Article

Image may be NSFW.
Clik here to view.

Is there a way to specify an icon to appear next to a menu item via the...

The MENU­ITEM­INFO structure lets you specify a bitmap to appear next to the menu item. Is there a way to do this from a menu resource template? No. If you look at the format of menu templates, you'll...

View Article


Image may be NSFW.
Clik here to view.

What does 1#J mean? A strange corner case of the printing of special values

As a puzzle, commenter nobugz asks, "What kind of infinity is 1.#J?" double z = 0; printf("%.2f", 1/z); Now, the division by zero results in IEEE positive infinity, would would normally be printed as...

View Article


Image may be NSFW.
Clik here to view.

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

Perhaps one of the most misunderstood sentences in the Win32 documentation is this little bit in the documentation for Create­File­Mapping: If hFile is INVALID_HANDLE_VALUE, the calling process must...

View Article

Image may be NSFW.
Clik here to view.

Marking a shortcut to say that it should not be placed on the Windows 8 Start...

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...

View Article

Image may be NSFW.
Clik here to view.

Around and around and back and somewhere else

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.

View Article

Image may be NSFW.
Clik here to view.

Inadvertently creating dress-like-Steve day

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...

View Article


Image may be NSFW.
Clik here to view.

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

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...

View Article

Image may be NSFW.
Clik here to view.

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

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...

View Article


Image may be NSFW.
Clik here to view.

What are the conventions for managing standard handles?

Consider this function: void ChangeConsoleColor(WORD wColor) { HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); if (h != INVALID_HANDLE_VALUE) { SetConsoleTextAttribute(h, wColor); CloseHandle(h); } }...

View Article

Image may be NSFW.
Clik here to view.

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

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 DIR in a command prompt. They are sometimes off by...

View Article


Image may be NSFW.
Clik here to view.

Microsoft-internal Chuck Norris facts

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...

View Article

Image may be NSFW.
Clik here to view.

How can I see what files and shares are being accessed remotely, and the...

Today's Little Program is a command line version of the Shared Folders MMC snap-in. Why? Because it illustrates the usage pattern for the Net­Xxx family of functions. (It's also a clone of the...

View Article

Image may be NSFW.
Clik here to view.

Derive the age of the planet Jupiter from the properties of liquid hydrogen...

I dreamed that my homework assignment was to derive the age of the planet Jupiter. The professor hinted that physical properties of liquid hydrogen and the current Jupiter surface temperature would be...

View Article
Browsing all 3085 articles
Browse latest View live