The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

How do I get the dropped height of a combo box?
Sep 20, 2010
Post comments count 0
Post likes count 0

How do I get the dropped height of a combo box?

Raymond Chen
Raymond Chen

Via the Suggestion Box, commenter Twisted Combo responds to an old blog entry on why the size of a combo box includes the height of the drop-down by asking, But how do I *get* the dropped down height?" By using the deviously-named message, which the header file wraps inside the macro. Start with the scratch program and make these changes: The actual results will naturally vary depending on your system configuration, but when I ran this program, the window caption said "24 / 500".

It's amazing how many business meetings there are in Munich in late September
Sep 17, 2010
Post comments count 0
Post likes count 0

It's amazing how many business meetings there are in Munich in late September

Raymond Chen
Raymond Chen

During my emergency vacation, we stopped at a German supermarket, and my friend loaded up on all sorts of odd and fascinating products. This is something he does every time he travels abroad. At the register, my friend did the work of unloading the cart onto the conveyor belt while I went ahead to bag and to deal with any questions from the cashier, since I was the only German-speaking person in our little group. The woman behind my friend looked at what he was buying and made some remark that implied that he did not make the most price-efficient choices. My friend replied, "Oh, we're from the United States, an...

What's up with the strange treatment of quotation marks and backslashes by CommandLineToArgvW
Sep 17, 2010
Post comments count 0
Post likes count 0

What's up with the strange treatment of quotation marks and backslashes by CommandLineToArgvW

Raymond Chen
Raymond Chen

The way the function treats quotation marks and backslashes has raised eyebrows at times. Let's look at the problem space, and then see what algorithm would work. Here are some sample command lines and what you presumably want them to be parsed as: In the first example, we want quotation marks to protect spaces. In the second example, we want to be able to enclose a path in quotation marks to protect the spaces. Backslashes inside the path have no special meaning; they are copied as any other normal character. So far, the rule is simple: Inside quotation marks, just copy until you see the matching quotation...

How is the CommandLineToArgvW function intended to be used?
Sep 16, 2010
Post comments count 0
Post likes count 0

How is the CommandLineToArgvW function intended to be used?

Raymond Chen
Raymond Chen

The function does some basic command line parsing. A customer reported that it was producing strange results when you passed an empty string as the first parameter: Well, okay, yeah, but huh? The first parameter to is supposed to be the value returned by . That's the command line, and that's what was designed to parse. If you pass something else, then will try to cope, but it's not really doing what it was designed for. It turns out that the customer was mistakenly passing the parameter that was passed to the function: That command line is not in the format that expects. The function wants the ...

Follow-up: The impact of overwhelmingly talented competitors on the rest of the field
Sep 15, 2010
Post comments count 0
Post likes count 0

Follow-up: The impact of overwhelmingly talented competitors on the rest of the field

Raymond Chen
Raymond Chen

A while back, I wrote on the impact of hardworking employees on their less diligent colleagues. Slate uncovered a study that demonstrated the reverse effect: How Tiger Woods makes everyone else on the course play worse. The magic ingredient is the incentive structure. If you have an incentive structure which rewards the best-performing person, and there is somebody who pretty much blows the rest of the field out of the water, then the incentive structure effectively slips down one notch. Everybody is now fighting for second place (since they've written off first place to Tiger Woods), and since the second plac...

How do I create a UNC to an IPv6 address?
Sep 15, 2010
Post comments count 0
Post likes count 0

How do I create a UNC to an IPv6 address?

Raymond Chen
Raymond Chen

Windows UNC notation permits you to use a raw IPv4 address in dotted notation as a server name: For example, will show you the shared resources on the computer whose IP address is 127.0.0.1. But what about IPv6 addresses? IPv6 notation contains colons, which tend to mess up file name parsing since a colon is not a valid character in a path component. Enter the domain. Take your IPv6 address, replace the colons with dashes, replace percent signs with the letter "s", and append . This magic host resolves back to the original IPv6 address, but it avoids characters which give parsers the heebie-jeebies. Note th...

Microspeak: Sats
Sep 14, 2010
Post comments count 0
Post likes count 0

Microspeak: Sats

Raymond Chen
Raymond Chen

I introduced this Microspeak last year as part of a general entry about management-speak, but I'm giving it its own entry because it deserves some attention on its own. I just want to have creative control over how my audience can interact with me without resorting to complex hacking in a way that is easy to explain but ups our blogging audiences sats to a new level that may also stimulate a developer ecosytem that breeds quality innovation... Ignore the other management-speak; we're looking at the weird four-letter word sats. Sats is short for satisfaction metrics. This falls under the overall obsession on...

Ha ha, the speaker gift is a speaker, get it?
Sep 13, 2010
Post comments count 0
Post likes count 0

Ha ha, the speaker gift is a speaker, get it?

Raymond Chen
Raymond Chen

As a thank-you for presenting at TechReady11, the conference organizers gave me (and presumably the other speakers) a portable speaker with the Windows logo printed on it. The speaker underneath the logo is the X-Mini II Capsule Speaker, and I have to agree with Steve Clayton that they pack a lot of sound in a compact size. Great for taking on trips, or even picnics. It's been a long time since I last recommended a Christmas gift for geeks, so maybe I'll make up for it by giving two suggestions this year. The second suggestion is a response to a comment from that old article: My bicycle lock is just a lapt...

Why doesn't Win32 give you the option of ignoring failures in DLL import resolution?
Sep 13, 2010
Post comments count 0
Post likes count 0

Why doesn't Win32 give you the option of ignoring failures in DLL import resolution?

Raymond Chen
Raymond Chen

Yuhong Bao asked, via the Suggestion Box, "Why not implement delay-loading by having a flag in the import entry specifying that Windows should mimic the Windows 3.1 behavior for resolving that import?" Okay, first we have to clear up the false assumptions in the question. The question assumes that Windows 3.1 had delay-loading functionality in the first place (functionality that Yuhong Bao would like added to Win32). Actually, Windows 3.1 behavior did not have any delay-load functionality. If your module imported from another DLL in its import table, the target DLL was loaded when your module was load...