diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-06-15 19:40:06 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-06-15 18:38:39 +0200 |
commit | 2086f693a31fa8f4afda5ea640a652dd13287687 (patch) | |
tree | a6269aedce8eced86495480e0fc77b74fbddfbb0 /vcl/win | |
parent | 01a60798c63a9e3f4246f2df6c64cd7815b6b4b5 (diff) |
Simplify a bit using newer registry API
Change-Id: I0bd2a238662e1da0c62cdaec96b9892df82298f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168909
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/window/salframe.cxx | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 288b561970f0..ebcb85f55cff 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -2652,22 +2652,15 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aMouseSettings.SetStartDragWidth( nDragWidth ); if ( nDragHeight ) aMouseSettings.SetStartDragHeight( nDragHeight ); - HKEY hRegKey; - if ( RegOpenKeyW( HKEY_CURRENT_USER, - L"Control Panel\\Desktop", - &hRegKey ) == ERROR_SUCCESS ) { wchar_t aValueBuf[10]; DWORD nValueSize = sizeof( aValueBuf ); - DWORD nType; - if ( RegQueryValueExW( hRegKey, L"MenuShowDelay", nullptr, - &nType, reinterpret_cast<LPBYTE>(aValueBuf), &nValueSize ) == ERROR_SUCCESS ) + if (RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"MenuShowDelay", + RRF_RT_REG_SZ, nullptr, reinterpret_cast<LPVOID>(aValueBuf), &nValueSize) + == ERROR_SUCCESS) { - if ( nType == REG_SZ ) - aMouseSettings.SetMenuDelay( static_cast<sal_uLong>(ImplW2I( aValueBuf )) ); + aMouseSettings.SetMenuDelay( static_cast<sal_uLong>(ImplW2I( aValueBuf )) ); } - - RegCloseKey( hRegKey ); } StyleSettings aStyleSettings = rSettings.GetStyleSettings(); @@ -2949,30 +2942,22 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetDragFullOptions( nDragFullOptions ); } - if ( RegOpenKeyW( HKEY_CURRENT_USER, - L"Control Panel\\International\\Calendars\\TwoDigitYearMax", - &hRegKey ) == ERROR_SUCCESS ) { wchar_t aValueBuf[10]; - DWORD nValue; DWORD nValueSize = sizeof( aValueBuf ); - DWORD nType; - if ( RegQueryValueExW( hRegKey, L"1", nullptr, - &nType, reinterpret_cast<LPBYTE>(aValueBuf), &nValueSize ) == ERROR_SUCCESS ) + if (RegGetValueW(HKEY_CURRENT_USER, + L"Control Panel\\International\\Calendars\\TwoDigitYearMax", L"1", + RRF_RT_REG_SZ, nullptr, reinterpret_cast<LPVOID>(aValueBuf), &nValueSize) + == ERROR_SUCCESS) { - if ( nType == REG_SZ ) + DWORD nValue = static_cast<sal_uLong>(ImplW2I(aValueBuf)); + if ((nValue > 1000) && (nValue < 10000)) { - nValue = static_cast<sal_uLong>(ImplW2I( aValueBuf )); - if ( (nValue > 1000) && (nValue < 10000) ) - { - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); - officecfg::Office::Common::DateFormat::TwoDigitYear::set(static_cast<sal_Int32>(nValue-99), batch); - batch->commit(); - } + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::DateFormat::TwoDigitYear::set(static_cast<sal_Int32>(nValue-99), batch); + batch->commit(); } } - - RegCloseKey( hRegKey ); } rSettings.SetMouseSettings( aMouseSettings ); |