On Vista, if a file type is not registered, AssocQueryString() returns

information about the "Unknown" application instead of admitting that
nothing is registered. The solution is to add ASSOCF_INIT_IGNOREUNKNOWN
to the flags parameter. Also update dead URLs.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@26499 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2008-09-22 22:07:23 +00:00
parent a098903b3b
commit 9a0b86749c
3 changed files with 11 additions and 12 deletions

View File

@ -258,18 +258,16 @@ bool canAutoOpenFile(string const & ext, auto_open_mode const mode)
DWORD bufSize = MAX_PATH + 100;
TCHAR buf[MAX_PATH + 100];
// reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc
// /platform/shell/reference/shlwapi/registry/assocquerystring.asp
// reference: http://msdn.microsoft.com/en-us/library/bb773471.aspx
char const * action = (mode == VIEW) ? "open" : "edit";
return S_OK == AssocQueryString(0, ASSOCSTR_EXECUTABLE,
full_ext.c_str(), action, buf, &bufSize);
return S_OK == AssocQueryString(ASSOCF_INIT_IGNOREUNKNOWN,
ASSOCSTR_EXECUTABLE, full_ext.c_str(), action, buf, &bufSize);
}
bool autoOpenFile(string const & filename, auto_open_mode const mode)
{
// reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc
// /platform/shell/reference/functions/shellexecute.asp
// reference: http://msdn.microsoft.com/en-us/library/bb762153.aspx
string const win_path = to_local8bit(from_utf8(convert_path(filename, PathStyle(windows))));
char const * action = (mode == VIEW) ? "open" : "edit";
return reinterpret_cast<int>(ShellExecute(NULL, action,

View File

@ -389,18 +389,16 @@ bool canAutoOpenFile(string const & ext, auto_open_mode const mode)
DWORD bufSize = MAX_PATH + 100;
TCHAR buf[MAX_PATH + 100];
// reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc
// /platform/shell/reference/shlwapi/registry/assocquerystring.asp
// reference: http://msdn.microsoft.com/en-us/library/bb773471.aspx
char const * action = (mode == VIEW) ? "open" : "edit";
return S_OK == AssocQueryString(0, ASSOCSTR_EXECUTABLE,
full_ext.c_str(), action, buf, &bufSize);
return S_OK == AssocQueryString(ASSOCF_INIT_IGNOREUNKNOWN,
ASSOCSTR_EXECUTABLE, full_ext.c_str(), action, buf, &bufSize);
}
bool autoOpenFile(string const & filename, auto_open_mode const mode)
{
// reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc
// /platform/shell/reference/functions/shellexecute.asp
// reference: http://msdn.microsoft.com/en-us/library/bb762153.aspx
char const * action = (mode == VIEW) ? "open" : "edit";
return reinterpret_cast<int>(ShellExecute(NULL, action,
to_local8bit(from_utf8(filename)).c_str(), NULL, NULL, 1)) > 32;

View File

@ -109,6 +109,9 @@ What's new
- Fix toggling of font and corresponding undo in mathed (bug 5246).
- On Windows Vista, fix application association when a file type is not
registered (in this case the "Unknown" application would be used).
* DOCUMENTATION AND LOCALIZATION