Showing results for 2014 - Page 5 of 31 - The Old New Thing

Nov 10, 2014
Post comments count0
Post likes count0

Kicking around a function that formats stuff

Raymond Chen
Raymond Chen

Today's "Little Program" is really a "Little Puzzle" that got out of hand. This started out as a practical question: This code fragment screams out for some sort of simplification. (I've changed the names of the classes.) Clearly, the pattern is Everything here is pretty straightforward, except for the part. Can we write a function that t...

Code
Nov 7, 2014
Post comments count0
Post likes count0

Why does an attempt to create a SysLink control in my plug-in sometimes fail?

Raymond Chen
Raymond Chen

A customer had written a plug-in for some application, and they found that their plug-in was unable to create a SysLink control via the function. The same code in a standalone application works fine, but when the code is placed in their plug-in, the code fails. Debugging showed that the call to succeeded, but the call failed with "Cannot find w...

Code
Nov 6, 2014
Post comments count0
Post likes count1

How do I get a handle to the primary monitor?

Raymond Chen
Raymond Chen

There are various ways of getting a monitor. You can get the monitor from a point, from a rectangle, or from a window. But how do you get the primary monitor? The primary monitor is defined to be the one which has (0, 0) as its origin. Therefore, one solution is The desktop window by convention is deemed to reside primarily on the primary mo...

Code
Nov 5, 2014
Post comments count0
Post likes count0

Passing the incorrect object type for a handle, how bad is it?

Raymond Chen
Raymond Chen

A customer asked a somewhat strange question: "We are calling but passing the handle to a waitable timer. Application Verifier reports, "Incorrect object type for handle." But the code works well. We want to know the risks of passing the wrong object type to . Is the recommendation only to pass handles of type "Event" to ? Let's answer those ques...

Code
Nov 4, 2014
Post comments count0
Post likes count0

Microspeak: Line of sight

Raymond Chen
Raymond Chen

I first encountered this term in a meeting I attended. Q: We would like to be able to reverse the polarity of the neutron flow without requiring a reboot. A: Yes, that is something we've been thinking about, but we don't have line of sight to having that feature before the end of the month. From context, having line of sight to a result mean...

OtherMicrospeak
Nov 3, 2014
Post comments count0
Post likes count1

Applying a filter to the contents of an Explorer Browser

Raymond Chen
Raymond Chen

Today's Little Program hosts an Explorer Browser but filters the contents to remove DLL files. You can, of course, substitute your own filter. (For example, maybe you want to show only files that changed since the last time the user ran your program, or you might want a view of My Computer but filtered to show only removable drives.) Remember th...

Code
Oct 31, 2014
Post comments count0
Post likes count0

The case of the file that won't copy because of an Invalid Handle error message

Raymond Chen
Raymond Chen

A customer reported that they had a file that was "haunted" on their machine: Explorer was unable to copy the file. If you did a copy/paste, the copy dialog displayed an error. Okay, time to roll up your sleeves and get to work. This investigation took several hours, but you'll be able to read it in ten minutes because I'm deleting all t...

Code
Oct 30, 2014
Post comments count0
Post likes count1

Why is the FAT driver called FASTFAT? Why would anybody ever write SLOWFAT?

Raymond Chen
Raymond Chen

Anon is interested in why the FAT driver is called FASTFAT.SYS. "Was there an earlier slower FAT driver? What could you possibly get so wrong with a FAT implementation that it needed to be chucked out?" The old FAT driver probably had a boring name like, um, FAT.SYS. At some point, somebody decided to write a newer, faster one, so they called it ...

History
Oct 29, 2014
Post comments count0
Post likes count0

The contents of the Start page are not programmatically accessible

Raymond Chen
Raymond Chen

A customer wanted to know if is possible for an application to edit the user's Start page. No, there is no interface for editing the user's Start page or even knowing what is on it. The Start page is the user's personal space and applications should not be messing with it. Imagine if it were possible. Every application would edit the Start page t...

Code