Kaydet (Commit) 6c670f63 authored tarafından Jesús Corrius's avatar Jesús Corrius Kaydeden (comit) Tor Lillqvist

fdo#35785: don't rely on the old apps fallback mechanism to fix this bug

Change-Id: Id0967358956868538f7563c51f7ed5e106771302
Reviewed-on: https://gerrit.libreoffice.org/3639Reviewed-by: 's avatarTor Lillqvist <tml@iki.fi>
Tested-by: 's avatarTor Lillqvist <tml@iki.fi>
üst 8d933732
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment