AssocQueryString and the Unknown Association

Most Apollo development for Windows is still being done on Windows XP, but we’re testing against at least some of the versions of Windows Vista.

On Windows XP, we’ve been using AssocQueryString to find the application associated with a particular file extension. (AssocQueryString is a utility function in the Shell that retrieves information about file types.) This broke on Vista, where the call was returning an answer even if no application was associated with the file extension.

The solution is to add ASSOCF_IGNOREUNKNOWN to the flags parameter. Otherwise, on Vista, if a file type is not registered it may return you information about the “Unknown” application instead of just fessing up and admitting nothing is registered. Again, this is a change from XP, which would admit the truth without this flag.

One more thing: Although ASSOCF_IGNOREUNKNOWN is defined in the Platform SDK documentation, it may not be defined in older versions of the Windows headers. Actual value: 0x400.

Comments are closed.