summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesús Corrius <jcorrius@gmail.com>2013-07-20 17:10:43 +0200
committerMichael Meeks <michael.meeks@suse.com>2013-07-22 10:53:55 +0000
commitf7d410edfa0866bd7759b2b977800d5744d8b544 (patch)
treeea9a949fe65d65799541c1cdeca05531d588e058
parenta6ae1cc0a2c5fd9f9bc0a834038b73e79b78fc6d (diff)
fdo#35785 LibreOffice's support of recent documents in Windows 7 broken
Change-Id: I916ba1335b0a0420f568ab9340632f273e3c9516 Reviewed-on: https://gerrit.libreoffice.org/4997 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org> (cherry picked from commit 19f3d9310caef84fe2815eb89af448a81937bddd) Shell32.dll is already loaded Since the vcllo.dll links already the shell32.dll because of its symbol SHAddToRecentDocs, no need to increase reference of that library. Just get the module handle. Moreover, a mere presence of the symbol SHGetPropertyStoreForWindow in shell32.dll indicates that we are running at least on Windows 7 or Windows Server 2008 R2. There is thus no need to check for the library version. Change-Id: I9ddfb8407fd805faf588779ac5fa8c10a0ae8898 Reviewed-on: https://gerrit.libreoffice.org/5016 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org> (cherry picked from commit 50d330c3d238b7b6182787959b30a6d665eab078) Reviewed-on: https://gerrit.libreoffice.org/5024 Reviewed-by: Jesús Corrius <jcorrius@gmail.com> Reviewed-by: Tor Lillqvist <tml@iki.fi> Reviewed-by: Michael Meeks <michael.meeks@suse.com> Tested-by: Michael Meeks <michael.meeks@suse.com>
-rw-r--r--desktop/win32/source/applauncher/launcher.cxx39
-rw-r--r--framework/source/helper/titlebarupdate.cxx32
-rw-r--r--scp2/source/base/registryitem_base.scp2
-rw-r--r--scp2/source/calc/registryitem_calc.scp8
-rw-r--r--scp2/source/draw/registryitem_draw.scp8
-rw-r--r--scp2/source/impress/registryitem_impress.scp8
-rw-r--r--scp2/source/math/registryitem_math.scp4
-rw-r--r--scp2/source/writer/registryitem_writer.scp14
-rw-r--r--vcl/Library_vcl.mk1
-rw-r--r--vcl/inc/win/salframe.h7
-rw-r--r--vcl/win/source/window/salframe.cxx49
11 files changed, 105 insertions, 67 deletions
diff --git a/desktop/win32/source/applauncher/launcher.cxx b/desktop/win32/source/applauncher/launcher.cxx
index c6a40d34400b..b0f031a9068b 100644
--- a/desktop/win32/source/applauncher/launcher.cxx
+++ b/desktop/win32/source/applauncher/launcher.cxx
@@ -34,51 +34,12 @@
#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 )
#else
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);
-
// Retreive startup info
STARTUPINFO aStartupInfo;
diff --git a/framework/source/helper/titlebarupdate.cxx b/framework/source/helper/titlebarupdate.cxx
index ddf55b7377a9..9b812494876c 100644
--- a/framework/source/helper/titlebarupdate.cxx
+++ b/framework/source/helper/titlebarupdate.cxx
@@ -172,7 +172,7 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr
OUString aModuleId = xModuleManager->identify(xFrame);
OUString sDesktopName;
-
+#if defined(UNX) && !defined(MACOSX)
if ( aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument")) ||
aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.GlobalDocument")) ||
aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.WebDocument")) ||
@@ -198,6 +198,34 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr
sApplicationID = utl::ConfigManager::getProductName().toAsciiLowerCase();
sApplicationID += OUString(sal_Unicode('-'));
sApplicationID += sDesktopName;
+#elif defined(WNT)
+ if ( aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument")) ||
+ aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.GlobalDocument")) ||
+ aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.WebDocument")) ||
+ aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.xforms.XMLFormDocument")) )
+ sDesktopName = OUString("Writer");
+ else if ( aModuleId == "com.sun.star.sheet.SpreadsheetDocument" )
+ sDesktopName = OUString("Calc");
+ else if ( aModuleId == "com.sun.star.presentation.PresentationDocument" )
+ sDesktopName = OUString("Impress");
+ else if ( aModuleId == "com.sun.star.drawing.DrawingDocument" )
+ sDesktopName = OUString("Draw");
+ else if ( aModuleId == "com.sun.star.formula.FormulaProperties" )
+ sDesktopName = OUString("Math");
+ else if ( aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sdb.DatabaseDocument")) ||
+ aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sdb.OfficeDatabaseDocument")) ||
+ aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sdb.RelationDesign")) ||
+ aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sdb.QueryDesign")) ||
+ aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sdb.TableDesign")) ||
+ aModuleId.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.sdb.DataSourceBrowser")) )
+ sDesktopName = OUString("Base");
+ else
+ sDesktopName = OUString("Startcenter");
+
+ // We use a hardcoded product name matching the registry keys so applications can be associated with file types
+ sApplicationID = "TheDocumentFoundation.LibreOffice.";
+ sApplicationID += sDesktopName;
+#endif
}
catch(const css::uno::Exception&)
{
@@ -275,7 +303,7 @@ void TitleBarUpdate::impl_forceUpdate()
impl_updateIcon (xFrame);
impl_updateTitle (xFrame);
-#if defined(UNX) && !defined(MACOSX)
+#if !defined(MACOSX)
impl_updateApplicationID (xFrame);
#endif
}
diff --git a/scp2/source/base/registryitem_base.scp b/scp2/source/base/registryitem_base.scp
index 020c6656d47a..69bf1d055f3e 100644
--- a/scp2/source/base/registryitem_base.scp
+++ b/scp2/source/base/registryitem_base.scp
@@ -84,7 +84,7 @@ RegistryItem gid_Regitem_Openoffice_Databasedocument_1_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "LibreOffice.DatabaseDocument.1";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Base";
End
RegistryItem gid_Regitem_Openoffice_Databasedocument_1_FriendlyTypeName
diff --git a/scp2/source/calc/registryitem_calc.scp b/scp2/source/calc/registryitem_calc.scp
index 3ed116709c75..a99a3f6f4268 100644
--- a/scp2/source/calc/registryitem_calc.scp
+++ b/scp2/source/calc/registryitem_calc.scp
@@ -283,7 +283,7 @@ RegistryItem gid_Regitem_Soffice_Starcalcdocument_6_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "soffice.StarCalcDocument.6";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Calc";
End
RegistryItem gid_Regitem_Soffice_Starcalcdocument_6_FriendlyTypeName
@@ -397,7 +397,7 @@ RegistryItem gid_Regitem_Soffice_Starcalctemplate_6_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "soffice.StarCalcTemplate.6";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Calc";
End
RegistryItem gid_Regitem_Soffice_Starcalctemplate_6_FriendlyTypeName
@@ -704,7 +704,7 @@ RegistryItem gid_Regitem_Openoffice_Calcdocument_1_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "LibreOffice.CalcDocument.1";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Calc";
End
RegistryItem gid_Regitem_Openoffice_Calcdocument_1_FriendlyTypeName
@@ -910,7 +910,7 @@ RegistryItem gid_Regitem_Openoffice_Calctemplate_1_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "LibreOffice.CalcTemplate.1";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Calc";
End
RegistryItem gid_Regitem_Openoffice_Calctemplate_1_FriendlyTypeName
diff --git a/scp2/source/draw/registryitem_draw.scp b/scp2/source/draw/registryitem_draw.scp
index 4c9c766e7d25..9c7823219fdf 100644
--- a/scp2/source/draw/registryitem_draw.scp
+++ b/scp2/source/draw/registryitem_draw.scp
@@ -283,7 +283,7 @@ RegistryItem gid_Regitem_Soffice_Stardrawdocument_6_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "soffice.StarDrawDocument.6";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Draw";
End
RegistryItem gid_Regitem_Soffice_Stardrawdocument_6_FriendlyTypeName
@@ -397,7 +397,7 @@ RegistryItem gid_Regitem_Soffice_Stardrawtemplate_6_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "soffice.StarDrawTemplate.6";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Draw";
End
RegistryItem gid_Regitem_Soffice_Stardrawtemplate_6_FriendlyTypeName
@@ -704,7 +704,7 @@ RegistryItem gid_Regitem_Openoffice_Drawdocument_1_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "LibreOffice.DrawDocument.1";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Draw";
End
RegistryItem gid_Regitem_Openoffice_Drawdocument_1_FriendlyTypeName
@@ -910,7 +910,7 @@ RegistryItem gid_Regitem_Openoffice_Drawtemplate_1_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "LibreOffice.DrawTemplate.1";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Draw";
End
RegistryItem gid_Regitem_Openoffice_Drawtemplate_1_FriendlyTypeName
diff --git a/scp2/source/impress/registryitem_impress.scp b/scp2/source/impress/registryitem_impress.scp
index 3d2472161151..92962c77e579 100644
--- a/scp2/source/impress/registryitem_impress.scp
+++ b/scp2/source/impress/registryitem_impress.scp
@@ -283,7 +283,7 @@ RegistryItem gid_Regitem_Soffice_Starimpressdocument_6_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "soffice.StarImpressDocument.6";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Impress";
End
RegistryItem gid_Regitem_Soffice_Starimpressdocument_6_FriendlyTypeName
@@ -411,7 +411,7 @@ RegistryItem gid_Regitem_Soffice_Starimpresstemplate_6_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "soffice.StarImpressTemplate.6";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Impress";
End
RegistryItem gid_Regitem_Soffice_Starimpresstemplate_6_FriendlyTypeName
@@ -719,7 +719,7 @@ RegistryItem gid_Regitem_Openoffice_Impressdocument_1_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "LibreOffice.ImpressDocument.1";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Impress";
End
RegistryItem gid_Regitem_Openoffice_Impressdocument_1_FriendlyTypeName
@@ -939,7 +939,7 @@ RegistryItem gid_Regitem_Openoffice_Impresstemplate_1_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "LibreOffice.ImpressTemplate.1";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Impress";
End
RegistryItem gid_Regitem_Openoffice_Impresstemplate_1_FriendlyTypeName
diff --git a/scp2/source/math/registryitem_math.scp b/scp2/source/math/registryitem_math.scp
index 6d6514fba67f..aa39a037779e 100644
--- a/scp2/source/math/registryitem_math.scp
+++ b/scp2/source/math/registryitem_math.scp
@@ -282,7 +282,7 @@ RegistryItem gid_Regitem_Soffice_Starmathdocument_6_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "soffice.StarMathDocument.6";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Math";
End
RegistryItem gid_Regitem_Soffice_Starmathdocument_6_FriendlyTypeName
@@ -560,7 +560,7 @@ RegistryItem gid_Regitem_Openoffice_Mathdocument_1_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "LibreOffice.MathDocument.1";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Math";
End
RegistryItem gid_Regitem_Openoffice_Mathdocument_1_FriendlyTypeName
diff --git a/scp2/source/writer/registryitem_writer.scp b/scp2/source/writer/registryitem_writer.scp
index 1e490ad4c39d..3120af83e364 100644
--- a/scp2/source/writer/registryitem_writer.scp
+++ b/scp2/source/writer/registryitem_writer.scp
@@ -283,7 +283,7 @@ RegistryItem gid_Regitem_Soffice_Starwriterdocument_6_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "soffice.StarWriterDocument.6";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Writer";
End
RegistryItem gid_Regitem_Soffice_Starwriterdocument_6_FriendlyTypeName
@@ -404,7 +404,7 @@ RegistryItem gid_Regitem_Soffice_Starwriterglobaldocument_6_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "soffice.StarWriterGlobalDocument.6";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Writer";
End
RegistryItem gid_Regitem_Soffice_Starwriterglobaldocument_6_FriendlyTypeName
@@ -491,7 +491,7 @@ RegistryItem gid_Regitem_Soffice_Starwritertemplate_6_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "soffice.StarWriterTemplate.6";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Writer";
End
RegistryItem gid_Regitem_Soffice_Starwritertemplate_6_FriendlyTypeName
@@ -854,7 +854,7 @@ RegistryItem gid_Regitem_Openoffice_Writerdocument_1_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "LibreOffice.WriterDocument.1";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Writer";
End
RegistryItem gid_Regitem_Openoffice_Writerdocument_1_FriendlyTypeName
@@ -1083,7 +1083,7 @@ RegistryItem gid_Regitem_Openoffice_Writertemplate_1_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "LibreOffice.WriterTemplate.1";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Writer";
End
RegistryItem gid_Regitem_Openoffice_Writertemplate_1_FriendlyTypeName
@@ -1235,7 +1235,7 @@ RegistryItem gid_Regitem_Openoffice_Writerglobaldocument_1_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "LibreOffice.WriterGlobalDocument.1";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Writer";
End
RegistryItem gid_Regitem_Openoffice_Writerglobaldocument_1_FriendlyTypeName
@@ -1387,7 +1387,7 @@ RegistryItem gid_Regitem_Openoffice_WriterWebTemplate_1_AppUserModelID
ComponentCondition = "VersionNT >= 601";
Subkey = "LibreOffice.WriterWebTemplate.1";
Name = "AppUserModelID";
- Value = "TheDocumentFoundation.LibreOffice";
+ Value = "TheDocumentFoundation.LibreOffice.Writer";
End
RegistryItem gid_Regitem_Openoffice_WriterWebTemplate_1_FriendlyTypeName
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index b1f3f491ad0d..0669590312f5 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -652,6 +652,7 @@ $(eval $(call gb_Library_use_system_win32_libs,vcl,\
uuid \
version \
winspool \
+ shlwapi \
))
$(eval $(call gb_Library_add_nativeres,vcl,vcl/salsrc))
diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h
index 4076d61451d3..cdde4b9a7a68 100644
--- a/vcl/inc/win/salframe.h
+++ b/vcl/inc/win/salframe.h
@@ -77,10 +77,11 @@ public:
sal_Bool mbCandidateMode; // TRUE: Wir befinden uns im Candidate-Modus
static sal_Bool mbInReparent; // TRUE: ignore focus lost and gain due to reparenting
- RGNDATA* mpClipRgnData;
- RECT* mpNextClipRect;
+ RGNDATA* mpClipRgnData;
+ RECT* mpNextClipRect;
sal_Bool mbFirstClipRect;
- sal_Int32 mnDisplay; // Display used for Fullscreen, 0 is primary monitor
+ sal_Int32 mnDisplay; // Display used for Fullscreen, 0 is primary monitor
+ sal_Bool mbPropertiesStored; // has values stored in the window property store
void updateScreenNumber();
public:
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 8ced16ce61b3..f32f9feae163 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -90,6 +90,12 @@ using ::std::max;
#include <sehandler.hxx>
#endif
+#include <windows.h>
+#include <shobjidl.h>
+#include <propkey.h>
+#include <propvarutil.h>
+#include <shellapi.h>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -885,6 +891,7 @@ WinSalFrame::WinSalFrame()
mbFirstClipRect = TRUE;
mpNextClipRect = NULL;
mnDisplay = 0;
+ mbPropertiesStored = FALSE;
memset( &maState, 0, sizeof( SalFrameState ) );
maSysData.nSize = sizeof( SystemEnvData );
@@ -975,6 +982,10 @@ WinSalFrame::~WinSalFrame()
}
}
+ // remove windows properties
+ if ( mbPropertiesStored )
+ SetApplicationID( OUString() );
+
// destroy system frame
if ( !DestroyWindow( mhWnd ) )
SetWindowPtr( mhWnd, 0 );
@@ -1896,8 +1907,44 @@ void WinSalFrame::SetScreenNumber( unsigned int nNewScreen )
}
}
-void WinSalFrame::SetApplicationID( const OUString &/*rApplicationID*/ )
+void WinSalFrame::SetApplicationID( const OUString &rApplicationID )
{
+ if( aSalShlData.maVersionInfo.dwMajorVersion >= 6 )
+ {
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/dd378430(v=vs.85).aspx
+ // A window's properties must be removed before the window is closed.
+
+ typedef HRESULT ( WINAPI *SHGETPROPERTYSTOREFORWINDOW )( HWND, REFIID, void ** );
+ SHGETPROPERTYSTOREFORWINDOW pSHGetPropertyStoreForWindow;
+ pSHGetPropertyStoreForWindow = ( SHGETPROPERTYSTOREFORWINDOW )GetProcAddress(
+ GetModuleHandleW (L"shell32.dll"), "SHGetPropertyStoreForWindow" );
+
+ // A mere presence of the symbol means we are at least on Windows 7 or Windows Server 2008 R2
+ if( pSHGetPropertyStoreForWindow )
+ {
+ IPropertyStore *pps;
+ HRESULT hr = pSHGetPropertyStoreForWindow ( mhWnd, IID_PPV_ARGS(&pps) );
+ if ( SUCCEEDED(hr) )
+ {
+ PROPVARIANT pv;
+ if ( !rApplicationID.isEmpty() )
+ {
+ hr = InitPropVariantFromString( rApplicationID.getStr(), &pv );
+ mbPropertiesStored = TRUE;
+ }
+ else
+ // if rApplicationID we remove the property from the window, if present
+ PropVariantInit( &pv );
+
+ if ( SUCCEEDED(hr) )
+ {
+ hr = pps->SetValue( PKEY_AppUserModel_ID, pv );
+ PropVariantClear( &pv );
+ }
+ pps->Release();
+ }
+ }
+ }
}
// -----------------------------------------------------------------------