Showing results for November 2013 - The Old New Thing

Nov 29, 2013
0
0

Notes on gift card and gift certificates in the state of Washington

Raymond Chen
Raymond Chen

Today is the unofficial start of the holiday shopping season. One of my colleagues read the fine print of a gift card he received: A monthly maintenance fee of $3 applies but is waived for the first twelve months after the card is issued. Thereafter, monthly maintenance fees are waived for an additional three months if the card is used in any ...

Non-Computer
Nov 29, 2013
0
0

Why can't I create my dialog with DialogBox, DialogBoxParam, CreateDialog, CreateDialogParam, or the indirect versions of same?

Raymond Chen
Raymond Chen

One of the purposes of my dialog manager series was to help people diagnose problems with their dialog boxes. But since I embedded the tips inside the series body, it's hard for people to find them, and I still end up answering the same questions over and over. So here it is in a separate article that hopefully people can find. Why your call ...

Code
Nov 28, 2013
0
0

Things that can happen when your kitchen gets taken over by others

Raymond Chen
Raymond Chen

Today is the Thanksgiving holiday in the United States, one of the the major holidays for family get-togethers. (Another big one is Christmas.) One year, it was our family's turn to host Thanksgiving, and when that happens, it means that the kitchen is overrun by relatives cooking all the dishes and hunting through the cabinets and drawers of an ...

Non-Computer
Nov 28, 2013
0
0

If you try to declare a variadic function with an incompatible calling convention, the compiler secretly converts it to cdecl

Raymond Chen
Raymond Chen

Consider the following function on an x86 system: The function declares itself as , which is a callee-clean convention. But a variadic function cannot be callee-clean since the callee does not know how many parameters were passed, so it doesn't know how many it should clean. The Microsoft Visual Studio C/C++ compiler resolves this conflict by...

Code
Nov 27, 2013
0
0

The case of the DLL that refuses to load

Raymond Chen
Raymond Chen

A customer reported that they had a problem that occurred only on some machines but not others. Their application called and the call succeeded on some machines, but failed on others with error ("The specified module could not be found"). The path was a fully-qualified path to a file that was confirmed to exist and be readable. If the ...

Code
Nov 26, 2013
0
0

Why did Raymond bring a knitting bag to every meeting?

Raymond Chen
Raymond Chen

I stopped knitting a few years ago, but back when I knitted regularly, I tended to bring my knitting bag with me everywhere I went. There are a lot of idle minutes in your typical day. Waiting for the bus, waiting in line for the ATM, waiting for a meeting to start. There's not enough time in those idle minutes to do anything substantial, but it's...

Other
Nov 25, 2013
0
0

My friend lived in an apartment inside a museum

Raymond Chen
Raymond Chen

One evening, I had a series of three dreams. In each one, I visited an unusual home. In the second dream, I visited the home of a friend of mine. She lived in a modern luxury apartment inside an art museum. It was a little tricky, because you could visit her only during museum hours. If you stayed past closing time, then you were locked inside the...

Non-ComputerDream
Nov 25, 2013
0
0

Extracting GPS coordinates from a photo and plotting it on a map

Raymond Chen
Raymond Chen

Today's Little Program extracts GPS coordinates from a photo and plots it on a map. Remember, Little Programs do little to no error checking, because that's how they roll. We start with a simple function that takes a latitude and longitude and opens a Web page that highlights that coordinate. In a real program, you probably would do something ...

Code
Nov 22, 2013
0
0

How do I get the effect of CW_USEDEFAULT positioning on a window I've already created?

Raymond Chen
Raymond Chen

A customer wanted to know how to get the effect of positioning on a window that already exists. In particular, they wanted to be able to reposition a dialog box to get the cascade effect, but since you can't actually pass in a dialog template, the repositioning has to be done after the fact. (Presumably in the handler, which runs before the ...

Code
Nov 21, 2013
0
0

How do I get the path to the default user's profile?

Raymond Chen
Raymond Chen

A customer wanted to know how to get the path to the default user's profile. On older versions of Windows, the default location of the default user's profile was . Then it moved to . Now it's in . And the location may have been customized, so in principle it could be anywhere. The function to get the default user profile's directory is is the ...

Code

Feedback