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

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…

25

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

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…

18

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

Consider the following function on an x86 system: void __stdcall something(char *, …); The function declares itself as __stdcall, 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…

16

The case of the DLL that refuses to load

A customer reported that they had a problem that occurred only on some machines but not others. Their application called HINSTANCE hinst = LoadLibraryEx(strModule, LOAD_WITH_ALTERED_SEARCH_PATH); and the call succeeded on some machines, but failed on others with error ERROR_MOD_NOT_FOUND (“The specified module could not be found”). The path was a fully-qualified path to a file…

17

Why did Raymond bring a knitting bag to every meeting?

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…

31

My friend lived in an apartment inside a museum

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

10

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

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. #define STRICT #define UNICODE #define _UNICODE #include <windows.h> #include <shlobj.h> #include <shellapi.h> #include <propidl.h> #include <propkey.h> #include <propvarutil.h> #include <atlbase.h> #include <atlalloc.h> #include <strsafe.h> void OpenMap(double…

13

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

A customer wanted to know how to get the effect of CW_USE­DEFAULT positioning on a window that already exists. In particular, they wanted to be able to reposition a dialog box to get the CW_USE­DEFAULT cascade effect, but since you can’t actually pass CW_USE­DEFAULT in a dialog template, the repositioning has to be done after…

37

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

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 C:\WINNT\Profiles\Default. Then it moved to C:\Documents and Settings\Default User. Now it’s in C:\Users\Default. And the location may have been customized, so in principle it could be…

22