[PATCH] fdo#35785: don't rely on the old apps fallback mechanism to ...
Jesús Corrius (via_Code_Review)
gerrit at gerrit.libreoffice.org
Sat Apr 27 11:11:37 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3639
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/39/3639/1
fdo#35785: don't rely on the old apps fallback mechanism to fix this bug
Change-Id: Id0967358956868538f7563c51f7ed5e106771302
---
M desktop/win32/source/applauncher/launcher.cxx
1 file changed, 39 insertions(+), 1 deletion(-)
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 _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;
--
To view, visit https://gerrit.libreoffice.org/3639
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0967358956868538f7563c51f7ed5e106771302
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Jesús Corrius <jcorrius at gmail.com>
More information about the LibreOffice
mailing list