4 * Copyright 2013 - Edijs Kolesnikovics
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 TASKBAR_SETTINGS TaskBarSettings
;
24 const WCHAR szSettingsKey
[] = L
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer";
25 const WCHAR szAdvancedSettingsKey
[] = L
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced";
28 LoadTaskBarSettings(VOID
)
32 LoadSettingDword(szAdvancedSettingsKey
, TEXT("TaskbarSizeMove"), dwValue
);
33 TaskBarSettings
.bLock
= (dwValue
!= 0) ? TRUE
: FALSE
;
35 LoadSettingDword(szAdvancedSettingsKey
, TEXT("ShowSeconds"), dwValue
);
36 TaskBarSettings
.bShowSeconds
= (dwValue
!= 0) ? TRUE
: FALSE
;
38 LoadSettingDword(szSettingsKey
, TEXT("EnableAutotray"), dwValue
);
39 TaskBarSettings
.bHideInactiveIcons
= TRUE
;
41 LoadSettingDword(szAdvancedSettingsKey
, TEXT("TaskbarGlomming"), dwValue
);
42 TaskBarSettings
.bGroupButtons
= (dwValue
!= 0) ? TRUE
: FALSE
;
44 TaskBarSettings
.bShowQuickLaunch
= TRUE
; //FIXME: Where is this stored, and how?
46 /* FIXME: The following settings are stored in stuckrects2, do they have to be load here too? */
47 TaskBarSettings
.bShowClock
= TRUE
;
48 TaskBarSettings
.bAutoHide
= FALSE
;
49 TaskBarSettings
.bAlwaysOnTop
= FALSE
;
54 SaveTaskBarSettings(VOID
)
56 SaveSettingDword(szAdvancedSettingsKey
, TEXT("TaskbarSizeMove"), TaskBarSettings
.bLock
);
57 SaveSettingDword(szAdvancedSettingsKey
, TEXT("ShowSeconds"), TaskBarSettings
.bShowSeconds
);
58 SaveSettingDword(szSettingsKey
, TEXT("EnableAutotray"), TaskBarSettings
.bHideInactiveIcons
);
59 SaveSettingDword(szAdvancedSettingsKey
, TEXT("TaskbarGlomming"), TaskBarSettings
.bGroupButtons
);
61 /* FIXME: Show Clock, AutoHide and Always on top are stored in the stuckrects2 key but are not written to it with a click on apply. How is this done instead?
62 AutoHide writes something to HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0 figure out what and why */
66 LoadSettingDword(IN LPCWSTR pszKeyName
,
67 IN LPCWSTR pszValueName
,
73 if (RegOpenKeyW(HKEY_CURRENT_USER
, pszKeyName
, &hKey
) == ERROR_SUCCESS
)
75 DWORD dwValueLength
, dwType
;
77 dwValueLength
= sizeof(dwValue
);
78 ret
= RegQueryValueExW(hKey
, pszValueName
, NULL
, &dwType
, (PBYTE
)&dwValue
, &dwValueLength
) == ERROR_SUCCESS
&& dwType
== REG_DWORD
;
87 SaveSettingDword(IN LPCWSTR pszKeyName
,
88 IN LPCWSTR pszValueName
,
94 if (RegCreateKeyW(HKEY_CURRENT_USER
, pszKeyName
, &hKey
) == ERROR_SUCCESS
)
96 ret
= RegSetValueExW(hKey
, pszValueName
, 0, REG_DWORD
, (PBYTE
)&dwValue
, sizeof(dwValue
)) == ERROR_SUCCESS
;