ReactOS
0.4.15-dev-7131-ge4d03f4
settings.cpp
Go to the documentation of this file.
1
/*
2
* ReactOS Explorer
3
*
4
* Copyright 2013 - Edijs Kolesnikovics
5
*
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.
10
*
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.
15
*
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
19
*/
20
21
#include "
precomp.h
"
22
23
TaskbarSettings
g_TaskbarSettings
;
24
25
BOOL
TaskbarSettings::Save
()
26
{
27
SHSetValueW
(
hkExplorer
,
NULL
,
L
"EnableAutotray"
,
REG_DWORD
, &
bHideInactiveIcons
,
sizeof
(
bHideInactiveIcons
));
28
SHSetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"PreferDateOverWeekday"
,
REG_DWORD
, &
bPreferDate
,
sizeof
(
bPreferDate
));
29
SHSetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"ShowSeconds"
,
REG_DWORD
, &
bShowSeconds
,
sizeof
(
bShowSeconds
));
30
SHSetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"TaskbarGlomming"
,
REG_DWORD
, &
bGroupButtons
,
sizeof
(
bGroupButtons
));
31
BOOL
bAllowSizeMove = !
bLock
;
32
SHSetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"TaskbarSizeMove"
,
REG_DWORD
, &bAllowSizeMove,
sizeof
(bAllowSizeMove));
33
sr
.
cbSize
=
sizeof
(
sr
);
34
SHSetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"TaskbarSmallIcons"
,
REG_DWORD
, &
bSmallIcons
,
sizeof
(
bSmallIcons
));
35
SHSetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"CompactTrayIcons"
,
REG_DWORD
, &
bCompactTrayIcons
,
sizeof
(
bCompactTrayIcons
));
36
SHSetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"TaskbarSd"
,
REG_DWORD
, &
bShowDesktopButton
,
sizeof
(
bShowDesktopButton
));
37
SHSetValueW
(
hkExplorer
,
L
"StuckRects2"
,
L
"Settings"
,
REG_BINARY
, &
sr
,
sizeof
(
sr
));
38
39
/* TODO: AutoHide writes something to HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0 figure out what and why */
40
return
TRUE
;
41
}
42
43
BOOL
TaskbarSettings::Load
()
44
{
45
DWORD
dwRet, cbSize, dwValue =
NULL
;
46
47
cbSize =
sizeof
(dwValue);
48
dwRet =
SHGetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"TaskbarSizeMove"
,
NULL
, &dwValue, &cbSize);
49
bLock
= (dwRet ==
ERROR_SUCCESS
) ? (dwValue == 0) :
TRUE
;
50
51
dwRet =
SHGetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"PreferDateOverWeekday"
,
NULL
, &dwValue, &cbSize);
52
bPreferDate
= (dwRet ==
ERROR_SUCCESS
) ? (dwValue != 0) :
FALSE
;
/* This is opt-in setting */
53
54
dwRet =
SHGetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"ShowSeconds"
,
NULL
, &dwValue, &cbSize);
55
bShowSeconds
= (dwRet ==
ERROR_SUCCESS
) ? (dwValue != 0) :
FALSE
;
56
57
dwRet =
SHGetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"TaskbarGlomming"
,
NULL
, &dwValue, &cbSize);
58
bGroupButtons
= (dwRet ==
ERROR_SUCCESS
) ? (dwValue != 0) :
FALSE
;
59
60
dwRet =
SHGetValueW
(
hkExplorer
,
NULL
,
L
"EnableAutotray"
,
NULL
, &dwValue, &cbSize);
61
bHideInactiveIcons
= (dwRet ==
ERROR_SUCCESS
) ? (dwValue != 0) :
FALSE
;
62
63
dwRet =
SHGetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"TaskbarSmallIcons"
,
NULL
, &dwValue, &cbSize);
64
bSmallIcons
= (dwRet ==
ERROR_SUCCESS
) ? (dwValue != 0) :
TRUE
;
65
66
dwRet =
SHGetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"CompactTrayIcons"
,
NULL
, &dwValue, &cbSize);
67
bCompactTrayIcons
= (dwRet ==
ERROR_SUCCESS
) ? (dwValue != 0) :
bSmallIcons
;
68
69
dwRet =
SHGetValueW
(
hkExplorer
,
L
"Advanced"
,
L
"TaskbarSd"
,
NULL
, &dwValue, &cbSize);
70
bShowDesktopButton
= (dwRet ==
ERROR_SUCCESS
) ? (dwValue != 0) :
TRUE
;
71
72
cbSize =
sizeof
(
sr
);
73
dwRet =
SHGetValueW
(
hkExplorer
,
L
"StuckRects2"
,
L
"Settings"
,
NULL
, &
sr
, &cbSize);
74
75
/* Make sure we have correct values here */
76
if
(dwRet !=
ERROR_SUCCESS
||
sr
.
cbSize
!=
sizeof
(
sr
) || cbSize !=
sizeof
(
sr
))
77
{
78
sr
.
Position
=
ABE_BOTTOM
;
79
sr
.
AutoHide
=
FALSE
;
80
sr
.
AlwaysOnTop
=
TRUE
;
81
sr
.
SmallIcons
=
TRUE
;
82
sr
.
HideClock
=
FALSE
;
83
sr
.
Rect
.
left
=
sr
.
Rect
.
top
= 0;
84
sr
.
Rect
.
bottom
=
sr
.
Rect
.
right
= 1;
85
sr
.
Size
.
cx
=
sr
.
Size
.
cy
= 0;
86
}
87
else
88
{
89
if
(
sr
.
Position
>
ABE_BOTTOM
)
90
sr
.
Position
=
ABE_BOTTOM
;
91
}
92
93
return
TRUE
;
94
}
95
96
/* EOF */
hkExplorer
HKEY hkExplorer
Definition:
explorer.cpp:26
g_TaskbarSettings
TaskbarSettings g_TaskbarSettings
Definition:
settings.cpp:23
ERROR_SUCCESS
#define ERROR_SUCCESS
Definition:
deptool.c:10
NULL
#define NULL
Definition:
types.h:112
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
SHGetValueW
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition:
reg.c:1236
SHSetValueW
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition:
reg.c:1306
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
REG_BINARY
#define REG_BINARY
Definition:
nt_native.h:1496
L
#define L(x)
Definition:
ntvdm.h:50
REG_DWORD
#define REG_DWORD
Definition:
sdbapi.c:596
ABE_BOTTOM
#define ABE_BOTTOM
Definition:
shellapi.h:20
TaskbarSettings
Definition:
precomp.h:208
TaskbarSettings::bGroupButtons
BOOL bGroupButtons
Definition:
precomp.h:210
TaskbarSettings::bShowDesktopButton
BOOL bShowDesktopButton
Definition:
precomp.h:216
TaskbarSettings::bCompactTrayIcons
BOOL bCompactTrayIcons
Definition:
precomp.h:215
TaskbarSettings::bHideInactiveIcons
BOOL bHideInactiveIcons
Definition:
precomp.h:213
TaskbarSettings::bLock
BOOL bLock
Definition:
precomp.h:209
TaskbarSettings::sr
TW_STRUCKRECTS2 sr
Definition:
precomp.h:217
TaskbarSettings::bShowSeconds
BOOL bShowSeconds
Definition:
precomp.h:211
TaskbarSettings::Load
BOOL Load()
Definition:
settings.cpp:43
TaskbarSettings::bPreferDate
BOOL bPreferDate
Definition:
precomp.h:212
TaskbarSettings::bSmallIcons
BOOL bSmallIcons
Definition:
precomp.h:214
TaskbarSettings::Save
BOOL Save()
Definition:
settings.cpp:25
_SIZE::cx
LONG cx
Definition:
kdterminal.h:27
_SIZE::cy
LONG cy
Definition:
kdterminal.h:28
_TW_STUCKRECTS2::SmallIcons
DWORD SmallIcons
Definition:
precomp.h:198
_TW_STUCKRECTS2::AutoHide
DWORD AutoHide
Definition:
precomp.h:196
_TW_STUCKRECTS2::HideClock
DWORD HideClock
Definition:
precomp.h:199
_TW_STUCKRECTS2::AlwaysOnTop
DWORD AlwaysOnTop
Definition:
precomp.h:197
_TW_STUCKRECTS2::Size
SIZE Size
Definition:
precomp.h:203
_TW_STUCKRECTS2::Position
DWORD Position
Definition:
precomp.h:202
_TW_STUCKRECTS2::Rect
RECT Rect
Definition:
precomp.h:204
_TW_STUCKRECTS2::cbSize
DWORD cbSize
Definition:
precomp.h:189
tagRECT::right
LONG right
Definition:
windef.h:308
tagRECT::bottom
LONG bottom
Definition:
windef.h:309
tagRECT::top
LONG top
Definition:
windef.h:307
tagRECT::left
LONG left
Definition:
windef.h:306
precomp.h
base
shell
explorer
settings.cpp
Generated on Tue Dec 5 2023 06:10:39 for ReactOS by
1.9.6