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 TaskbarSettings g_TaskbarSettings
;
25 BOOL
TaskbarSettings::Save()
27 SHSetValueW(hkExplorer
, NULL
, L
"EnableAutotray", REG_DWORD
, &bHideInactiveIcons
, sizeof(bHideInactiveIcons
));
28 SHSetValueW(hkExplorer
, L
"Advanced", L
"ShowSeconds", REG_DWORD
, &bShowSeconds
, sizeof(bShowSeconds
));
29 SHSetValueW(hkExplorer
, L
"Advanced", L
"TaskbarGlomming", REG_DWORD
, &bGroupButtons
, sizeof(bGroupButtons
));
30 BOOL bAllowSizeMove
= !bLock
;
31 SHSetValueW(hkExplorer
, L
"Advanced", L
"TaskbarSizeMove", REG_DWORD
, &bAllowSizeMove
, sizeof(bAllowSizeMove
));
32 sr
.cbSize
= sizeof(sr
);
33 SHSetValueW(hkExplorer
, L
"StuckRects2", L
"Settings", REG_BINARY
, &sr
, sizeof(sr
));
35 /* TODO: AutoHide writes something to HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0 figure out what and why */
39 BOOL
TaskbarSettings::Load()
41 DWORD dwRet
, cbSize
, dwValue
= NULL
;
43 cbSize
= sizeof(dwValue
);
44 dwRet
= SHGetValueW(hkExplorer
, L
"Advanced", L
"TaskbarSizeMove", NULL
, &dwValue
, &cbSize
);
45 bLock
= (dwRet
== ERROR_SUCCESS
) ? (dwValue
== 0) : TRUE
;
47 dwRet
= SHGetValueW(hkExplorer
, L
"Advanced", L
"ShowSeconds", NULL
, &dwValue
, &cbSize
);
48 bShowSeconds
= (dwRet
== ERROR_SUCCESS
) ? (dwValue
!= 0) : FALSE
;
50 dwRet
= SHGetValueW(hkExplorer
, L
"Advanced", L
"TaskbarGlomming", NULL
, &dwValue
, &cbSize
);
51 bGroupButtons
= (dwRet
== ERROR_SUCCESS
) ? (dwValue
!= 0) : FALSE
;
53 dwRet
= SHGetValueW(hkExplorer
, NULL
, L
"EnableAutotray", NULL
, &dwValue
, &cbSize
);
54 bHideInactiveIcons
= (dwRet
== ERROR_SUCCESS
) ? (dwValue
!= 0) : FALSE
;
57 dwRet
= SHGetValueW(hkExplorer
, L
"StuckRects2", L
"Settings", NULL
, &sr
, &cbSize
);
59 /* Make sure we have correct values here */
60 if (dwRet
!= ERROR_SUCCESS
|| sr
.cbSize
!= sizeof(sr
) || cbSize
!= sizeof(sr
))
62 sr
.Position
= ABE_BOTTOM
;
64 sr
.AlwaysOnTop
= TRUE
;
67 sr
.Rect
.left
= sr
.Rect
.top
= 0;
68 sr
.Rect
.bottom
= sr
.Rect
.right
= 1;
69 sr
.Size
.cx
= sr
.Size
.cy
= 0;
73 if (sr
.Position
> ABE_BOTTOM
)
74 sr
.Position
= ABE_BOTTOM
;