Fix fdo#35785: recent documents feature of the Windows 7 Start menu broken

Change-Id: I61cffeaf661db7e7b8f642bbbd9457203f75cb9a
Reviewed-on: https://gerrit.libreoffice.org/3623
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Tor Lillqvist <tml@iki.fi>
diff --git a/desktop/win32/source/applauncher/launcher.cxx b/desktop/win32/source/applauncher/launcher.cxx
index d72d7dd..0edcdbf 100644
--- a/desktop/win32/source/applauncher/launcher.cxx
+++ b/desktop/win32/source/applauncher/launcher.cxx
@@ -34,8 +34,6 @@
#include <stdlib.h>
#include <malloc.h>

#define PACKVERSION(major,minor) MAKELONG(minor,major)


#ifdef __MINGW32__
extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
@@ -43,41 +41,6 @@ extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
extern "C" int APIENTRY _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
#endif
{
    // 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);

    // Retrieve startup info

    STARTUPINFO aStartupInfo;
diff --git a/desktop/win32/source/applauncher/launcher.hxx b/desktop/win32/source/applauncher/launcher.hxx
index a937c8f..1ea51cf 100644
--- a/desktop/win32/source/applauncher/launcher.hxx
+++ b/desktop/win32/source/applauncher/launcher.hxx
@@ -43,6 +43,5 @@
#define OFFICE_IMAGE_NAME   _T("soffice")

extern _TCHAR APPLICATION_SWITCH[];
extern LPCWSTR APPUSERMODELID;

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/sbase.cxx b/desktop/win32/source/applauncher/sbase.cxx
index 4b51080..e6123a6 100644
--- a/desktop/win32/source/applauncher/sbase.cxx
+++ b/desktop/win32/source/applauncher/sbase.cxx
@@ -21,6 +21,4 @@

_TCHAR APPLICATION_SWITCH[] = _T( "--base" );

LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Base";

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/scalc.cxx b/desktop/win32/source/applauncher/scalc.cxx
index 356c719..4d11124 100644
--- a/desktop/win32/source/applauncher/scalc.cxx
+++ b/desktop/win32/source/applauncher/scalc.cxx
@@ -21,6 +21,4 @@

_TCHAR APPLICATION_SWITCH[] = _T( "--calc" );

LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Calc";

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/sdraw.cxx b/desktop/win32/source/applauncher/sdraw.cxx
index 8202f3a..57112523 100644
--- a/desktop/win32/source/applauncher/sdraw.cxx
+++ b/desktop/win32/source/applauncher/sdraw.cxx
@@ -21,6 +21,4 @@

_TCHAR APPLICATION_SWITCH[] = _T( "--draw" );

LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Draw";

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/simpress.cxx b/desktop/win32/source/applauncher/simpress.cxx
index 35b828f..53a0dcc 100644
--- a/desktop/win32/source/applauncher/simpress.cxx
+++ b/desktop/win32/source/applauncher/simpress.cxx
@@ -21,6 +21,4 @@

_TCHAR APPLICATION_SWITCH[] = _T( "--impress" );

LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Impress";

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/smath.cxx b/desktop/win32/source/applauncher/smath.cxx
index c52ee37..e71c84b 100644
--- a/desktop/win32/source/applauncher/smath.cxx
+++ b/desktop/win32/source/applauncher/smath.cxx
@@ -21,6 +21,4 @@

_TCHAR APPLICATION_SWITCH[] = _T( "--math" );

LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Math";

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/sweb.cxx b/desktop/win32/source/applauncher/sweb.cxx
index dc9b8b1..3824ece 100644
--- a/desktop/win32/source/applauncher/sweb.cxx
+++ b/desktop/win32/source/applauncher/sweb.cxx
@@ -21,6 +21,4 @@

_TCHAR APPLICATION_SWITCH[] = _T( "--web" );

LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Writer";

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/swriter.cxx b/desktop/win32/source/applauncher/swriter.cxx
index ba1f2b9..013ce9e 100644
--- a/desktop/win32/source/applauncher/swriter.cxx
+++ b/desktop/win32/source/applauncher/swriter.cxx
@@ -21,6 +21,4 @@

_TCHAR APPLICATION_SWITCH[] = _T( "--writer" );

LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Writer";

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */