How to tell if there's no default file extension association on OS post-Windows XP?
问题 Going back to the days of Windows XP one could use the following code to tell if there's no file association existed for an extension: TCHAR buffPath[MAX_PATH] = {0}; DWORD dwszBuffPath = MAX_PATH; HRESULT hR = ::AssocQueryString( ASSOCF_NOFIXUPS | ASSOCF_VERIFY, ASSOCSTR_EXECUTABLE, _T(".weirdassextension"), NULL, buffPath, &dwszBuffPath); if(hR != S_OK && hR != E_POINTER) { //Association does not exist } But since Windows 8, the AssocQueryString API returns S_OK and buffPath is set to