desktop/win32/source/applauncher/launcher.cxx |   40 +++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

New commits:
commit 6c670f63a7859e24bdfa20759bd8b7c3b4a911ef
Author: Jesús Corrius <jcorr...@gmail.com>
Date:   Sat Apr 27 20:11:25 2013 +0200

    fdo#35785: don't rely on the old apps fallback mechanism to fix this bug
    
    Change-Id: Id0967358956868538f7563c51f7ed5e106771302
    Reviewed-on: https://gerrit.libreoffice.org/3639
    Reviewed-by: Tor Lillqvist <t...@iki.fi>
    Tested-by: Tor Lillqvist <t...@iki.fi>

diff --git a/desktop/win32/source/applauncher/launcher.cxx 
b/desktop/win32/source/applauncher/launcher.cxx
index 0edcdbf..c6a40d3 100644
--- a/desktop/win32/source/applauncher/launcher.cxx
+++ b/desktop/win32/source/applauncher/launcher.cxx
@@ -34,6 +34,9 @@
 #include <stdlib.h>
 #include <malloc.h>
 
+#define PACKVERSION(major,minor) MAKELONG(minor,major)
+#define APPUSERMODELID L"TheDocumentFoundation.LibreOffice"
+
 
 #ifdef __MINGW32__
 extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
@@ -41,7 +44,42 @@ extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, 
LPSTR, int )
 extern "C" int APIENTRY _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
 #endif
 {
-    // Retrieve startup info
+    // Set an explicit Application User Model ID for the process
+
+    WCHAR szShell32[MAX_PATH];
+    GetSystemDirectoryW(szShell32, MAX_PATH);
+    wcscat(szShell32, L"\\Shell32.dll");
+
+    HINSTANCE hinstDll = LoadLibraryW(szShell32);
+
+    if(hinstDll)
+    {
+        DLLVERSIONINFO dvi;
+        ZeroMemory(&dvi, sizeof(dvi));
+        dvi.cbSize = sizeof(dvi);
+
+        DLLGETVERSIONPROC pDllGetVersion;
+        pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hinstDll, 
"DllGetVersion");
+        HRESULT hr = (*pDllGetVersion)(&dvi);
+
+        if(SUCCEEDED(hr))
+        {
+            DWORD dwVersion = PACKVERSION(dvi.dwMajorVersion, 
dvi.dwMinorVersion);
+            if(dwVersion >= PACKVERSION(6,1)) // Shell32 version in Windows 7
+            {
+                typedef HRESULT (WINAPI 
*SETCURRENTPROCESSEXPLICITAPPUSERMODELID)(PCWSTR);
+                SETCURRENTPROCESSEXPLICITAPPUSERMODELID 
pSetCurrentProcessExplicitAppUserModelID;
+                pSetCurrentProcessExplicitAppUserModelID =
+                    
(SETCURRENTPROCESSEXPLICITAPPUSERMODELID)GetProcAddress(hinstDll, 
"SetCurrentProcessExplicitAppUserModelID");
+
+                if(pSetCurrentProcessExplicitAppUserModelID)
+                    (*pSetCurrentProcessExplicitAppUserModelID) 
(APPUSERMODELID);
+            }
+        }
+    }
+    FreeLibrary(hinstDll);
+
+    // Retreive startup info
 
     STARTUPINFO aStartupInfo;
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to