]> git.lyx.org Git - features.git/commitdiff
On Vista, if a file type is not registered, AssocQueryString() returns
authorEnrico Forestieri <forenr@lyx.org>
Mon, 22 Sep 2008 00:07:48 +0000 (00:07 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Mon, 22 Sep 2008 00:07:48 +0000 (00:07 +0000)
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/trunk@26488 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/os_cygwin.cpp
src/support/os_win32.cpp

index cfaeb549f6330277b3de6e5b0b2c50c06bdc3530..f13d25c37b38b82751b4e7f8a2b0b1da1217da16 100644 (file)
@@ -241,18 +241,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,
index 385ebc606af64c4f2629e0d7f9615a4438048a20..1ff1b8ec78e901be641437c84404e5c41aa8d6ab 100644 (file)
@@ -347,19 +347,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;