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

May 10, 2013
0
0

If you want to use a name for your file mapping, don’t just use the name of the file itself

Raymond Chen
Raymond Chen

The original question from the customer was why they couldn't get named file mappings to work at all, but it turns out that the reason is that they were using the full path to the file as the name, even though backslashes have special meaning in file mapping names. Okay, that problem can be solved by changing the backslash to some character lega...

Code
May 9, 2013
0
0

Why am I getting LNK2019 unresolved external for my inline function?

Raymond Chen
Raymond Chen

More than once, I've seen somebody confused by how inline functions work. I have implemented a few inline functions in one of my cpp files, and I want to use it from other cpp files, so I declare them as extern. But sometimes I will get linker error 2019 (unresolved external) for the inline functions. // a.cpp inline bool foo() { return false...

Code
May 8, 2013
0
0

Mathematical formulas are designed to be pretty, not to be suitable for computation

Raymond Chen
Raymond Chen

When you ask a mathematician to come up with a formula to solve a problem, you will get something that looks pretty, but that doesn't mean that it lends itself well to computation. For example, consider the binomial coefficient, traditionally written nCk or C(n, k), and in more modern notation as ( nk ). If you ask a mathematician f...

Code
May 7, 2013
0
0

How to tell the poseurs from the actual Windows developers

Raymond Chen
Raymond Chen

Poseurs will call Windows versions by their programmatic version numbers. For example, they will call Windows Vista "NT6" and Windows 7 "NT6.1". Trust me, nobody on the Windows team calls the products by their programmatic version numbers. Whenever anybody says "NT6" I have to go to Wikipedia and look up what they're actually talking about. I...

Other
May 6, 2013
0
0

Reading mouse input from a console program, and programmatically turning off Quick Edit mode

Raymond Chen
Raymond Chen

Today's Little program shows how to read mouse input from a console program. You might use this if you are writing a console-mode text editor with mouse support, or maybe you want to want to add mouse support to your roguelike game. But I'm not going to implement the game itself. Instead, I'm just going to print mouse coordinates to the screen....

Code
May 3, 2013
0
0

Creating a simple pidl: For the times you care enough to send the very fake

Raymond Chen
Raymond Chen

I'll assume that we all know what pidls are and how the shell namespace uses them. That's the prerequisite for today. A simple pidl is an item ID list that refers to a file or directory that may not actually exist. It's a way of playing "what if": "If there were a file or directory at this location, here is what I would have created to represent...

Code
May 2, 2013
0
0

Any setting you expose to the user you implicitly expose to applications

Raymond Chen
Raymond Chen

Often, in response to some sort of design decision, people will say, "Well, sure, you made this decision because it would allow applications to do Bad Thing, but why not expose it as a setting the user can select? For example, let the user pick a Topper Than Topmost Awesome Top Window Super Top (Extra Super edition), and keep that window on top reg...

Other