ReactOS 0.4.15-dev-7842-g558ab78
desktop.c File Reference
#include "desk.h"
#include <shlwapi.h>
#include <shellapi.h>
Include dependency graph for desktop.c:

Go to the source code of this file.

Macros

#define FCIDM_DESKBROWSER_REFRESH   0xA220
 
#define IDS_TITLE_MYCOMP   30386
 
#define IDS_TITLE_MYNET   30387
 
#define IDS_TITLE_BIN_1   30388
 
#define IDS_TITLE_BIN_0   30389
 
#define IDS_PERSONAL   9227
 

Functions

VOID InitDesktopSettings (PDESKTOP_DATA pData)
 
BOOL SaveDesktopSettings (PDESKTOP_DATA pData)
 
static BOOL GetCurrentValue (UINT i, BOOL bNewStart)
 
static VOID SetCurrentValue (UINT i, BOOL bNewStart, BOOL bValue)
 
VOID SetDesktopSettings (PDESKTOP_DATA pData)
 
static HICON GetIconFromLocation (LPTSTR szIconPath)
 
static VOID DesktopOnInitDialog (IN HWND hwndDlg, IN PDESKTOP_DATA pData)
 
static VOID DesktopOnDestroyDialog (IN HWND hwndDlg, IN PDESKTOP_DATA pData)
 
INT_PTR CALLBACK DesktopPageProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 

Variables

static const TCHAR szHideDesktopIcons [] = TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\HideDesktopIcons\\")
 
static const TCHAR szClassicStartMenu [] = TEXT("ClassicStartMenu")
 
static const TCHAR szNewStartPanel [] = TEXT("NewStartPanel")
 
struct {
   LPCTSTR   CLSID
 
   UINT   Checkbox
 
DesktopIcons [NUM_DESKTOP_ICONS]
 
static const TCHAR szUserClass [] = TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\")
 
static const TCHAR szSysClass [] = TEXT("CLSID\\")
 
static const TCHAR szDefaultIcon [] = TEXT("\\DefaultIcon")
 
static const TCHAR szFallbackIcon [] = TEXT("%SystemRoot%\\system32\\shell32.dll,0")
 
struct {
   LPCTSTR   CLSID
 
   UINT   TitleId
 
   LPCTSTR   IconName
 
IconChange [NUM_CHANGE_ICONS]
 

Macro Definition Documentation

◆ FCIDM_DESKBROWSER_REFRESH

#define FCIDM_DESKBROWSER_REFRESH   0xA220

Definition at line 14 of file desktop.c.

◆ IDS_PERSONAL

#define IDS_PERSONAL   9227

Definition at line 27 of file desktop.c.

◆ IDS_TITLE_BIN_0

#define IDS_TITLE_BIN_0   30389

Definition at line 19 of file desktop.c.

◆ IDS_TITLE_BIN_1

#define IDS_TITLE_BIN_1   30388

Definition at line 18 of file desktop.c.

◆ IDS_TITLE_MYCOMP

#define IDS_TITLE_MYCOMP   30386

Definition at line 16 of file desktop.c.

◆ IDS_TITLE_MYNET

#define IDS_TITLE_MYNET   30387

Definition at line 17 of file desktop.c.

Function Documentation

◆ DesktopOnDestroyDialog()

static VOID DesktopOnDestroyDialog ( IN HWND  hwndDlg,
IN PDESKTOP_DATA  pData 
)
static

Definition at line 325 of file desktop.c.

326{
327 if (pData->hLocalImageList)
328 {
330 ImageList_Destroy(pData->hLocalImageList);
331 }
332
333 SetWindowLongPtr(hwndDlg, DWLP_USER, 0);
334}
#define NULL
Definition: types.h:112
#define IDC_ICONS_LISTVIEW
Definition: resource.h:189
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2304
#define LVSIL_NORMAL
Definition: commctrl.h:2298
#define SetWindowLongPtr
Definition: treelist.c:70
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
#define DWLP_USER
Definition: winuser.h:872
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)

Referenced by DesktopPageProc().

◆ DesktopOnInitDialog()

static VOID DesktopOnInitDialog ( IN HWND  hwndDlg,
IN PDESKTOP_DATA  pData 
)
static

Definition at line 240 of file desktop.c.

241{
242 UINT i;
243 SHELLSTATE ss = {0};
244 HWND hwndList;
245
247
248 for (i = 0; i < _countof(pData->optIcons); i++)
249 {
250 BOOL bHide;
251
252 if (ss.fStartPanelOn)
253 bHide = pData->optIcons[i].bHideNewStart;
254 else
255 bHide = pData->optIcons[i].bHideClassic;
256
257 CheckDlgButton(hwndDlg,
259 bHide ? BST_UNCHECKED : BST_CHECKED);
260
261 pData->bLocalHideIcon[i] = bHide;
262 pData->bLocalHideChanged[i] = FALSE;
263 }
264
265 pData->iLocalCurIcon = 0;
266 hwndList = GetDlgItem(hwndDlg, IDC_ICONS_LISTVIEW);
268 ListView_SetImageList(hwndList, pData->hLocalImageList, LVSIL_NORMAL);
269
270 for (i = 0; i < _countof(IconChange); i++)
271 {
272 TCHAR szClassPath[MAX_PATH];
273 DWORD dwType, cbData;
274 LVITEM lvitem = {0};
275 HICON hIcon;
276
277 StringCchCopy(pData->LocalIcon[i].szPath, _countof(pData->LocalIcon[i].szPath), pData->Icon[i].szPath);
278 pData->bLocalIconChanged[i] = FALSE;
279
280 /* Try loading user-defined desktop icon title */
281 StringCchCopy(szClassPath, _countof(szClassPath), szUserClass);
282 StringCchCat(szClassPath, _countof(szClassPath), IconChange[i].CLSID);
283 cbData = sizeof(pData->LocalIcon[i].szTitle);
284
285 if (SHGetValue(HKEY_CURRENT_USER, szClassPath, IconChange[i].IconName, &dwType,
286 pData->LocalIcon[i].szTitle, &cbData) != ERROR_SUCCESS || dwType != REG_SZ)
287 {
288 /* Fallback to predefined strings */
289 LoadString(GetModuleHandle(TEXT("shell32.dll")),
291 pData->LocalIcon[i].szTitle,
292 _countof(pData->LocalIcon[i].szTitle));
293 }
294
295 hIcon = GetIconFromLocation(pData->LocalIcon[i].szPath);
296
297 lvitem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
298 lvitem.iItem = i;
299 lvitem.iSubItem = 0;
300 lvitem.pszText = pData->LocalIcon[i].szTitle;
301 lvitem.lParam = (LPARAM)i;
302
303 if (hIcon)
304 {
305 if (pData->hLocalImageList)
306 lvitem.iImage = ImageList_AddIcon(pData->hLocalImageList, hIcon);
308 }
309
310 if (ListView_InsertItem(hwndList, &lvitem) < 0)
311 continue;
312
313 if (i > 0)
314 continue;
315
316 lvitem.state = LVIS_FOCUSED | LVIS_SELECTED;
317 lvitem.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
318 SendMessage(hwndList, LVM_SETITEMSTATE, 0, (LPARAM)&lvitem);
319 }
320
321 pData->bLocalSettingsChanged = FALSE;
322}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FALSE
Definition: types.h:117
struct @218 DesktopIcons[NUM_DESKTOP_ICONS]
LPCTSTR IconName
Definition: desktop.c:53
UINT Checkbox
Definition: desktop.c:36
static HICON GetIconFromLocation(LPTSTR szIconPath)
Definition: desktop.c:229
UINT TitleId
Definition: desktop.c:52
static const TCHAR szUserClass[]
Definition: desktop.c:44
struct @219 IconChange[NUM_CHANGE_ICONS]
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define MAX_PATH
Definition: compat.h:34
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ss
Definition: i386-dis.c:441
#define TEXT(s)
Definition: k32.h:26
#define REG_SZ
Definition: layer.c:22
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
unsigned int UINT
Definition: ndis.h:50
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
#define LVM_SETITEMSTATE
Definition: commctrl.h:2672
#define ILC_COLOR32
Definition: commctrl.h:358
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define LVITEM
Definition: commctrl.h:2375
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVIF_TEXT
Definition: commctrl.h:2309
#define ImageList_AddIcon(himl, hicon)
Definition: commctrl.h:415
#define ILC_MASK
Definition: commctrl.h:351
#define LVIF_IMAGE
Definition: commctrl.h:2310
#define LVIS_FOCUSED
Definition: commctrl.h:2318
VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
Definition: shellord.c:202
#define SSF_STARTPANELON
Definition: shlobj.h:1610
#define SHGetValue
Definition: shlwapi.h:70
#define _countof(array)
Definition: sndvol32.h:68
#define StringCchCopy
Definition: strsafe.h:139
#define StringCchCat
Definition: strsafe.h:317
#define GetModuleHandle
Definition: winbase.h:3762
LONG_PTR LPARAM
Definition: windef.h:208
#define HKEY_CURRENT_USER
Definition: winreg.h:11
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define BST_UNCHECKED
Definition: winuser.h:199
#define SM_CYICON
Definition: winuser.h:973
#define SendMessage
Definition: winuser.h:5843
#define LoadString
Definition: winuser.h:5819
#define SM_CXICON
Definition: winuser.h:972
int WINAPI GetSystemMetrics(_In_ int)
#define BST_CHECKED
Definition: winuser.h:197
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2053
char TCHAR
Definition: xmlstorage.h:189

Referenced by DesktopPageProc().

◆ DesktopPageProc()

INT_PTR CALLBACK DesktopPageProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)

Definition at line 338 of file desktop.c.

339{
341
343
344 switch (uMsg)
345 {
346 case WM_INITDIALOG:
347 {
349 pData = (PDESKTOP_DATA)ppsp->lParam;
350
352 DesktopOnInitDialog(hwndDlg, pData);
353 break;
354 }
355
356 case WM_DESTROY:
357 {
359 break;
360 }
361
362 case WM_COMMAND:
363 {
364 DWORD controlId = LOWORD(wParam);
366
367 if (command == BN_CLICKED)
368 {
369 UINT i;
370 BOOL bUpdateIcon = FALSE;
371
372 for (i = 0; i < _countof(DesktopIcons); i++)
373 {
374 if (DesktopIcons[i].Checkbox == controlId)
375 {
376 pData->bLocalHideIcon[i] =
378
379 pData->bLocalSettingsChanged =
380 pData->bLocalHideChanged[i] = TRUE;
381
382 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
383 break;
384 }
385 }
386
387 if (controlId == IDC_ICONS_CHANGEICON)
388 {
390 INT iIndex;
391 i = pData->iLocalCurIcon;
392
393 ExpandEnvironmentStrings(pData->LocalIcon[i].szPath, szPath, _countof(szPath));
395
396 if (PickIconDlg(hwndDlg, szPath, _countof(szPath), &iIndex))
397 {
398 StringCchCopy(pData->LocalIcon[i].szPath, _countof(pData->LocalIcon[i].szPath), szPath);
399 PathUnExpandEnvStrings(pData->LocalIcon[i].szPath, szPath, _countof(szPath));
400
401 StringCchPrintf(pData->LocalIcon[i].szPath, _countof(pData->LocalIcon[i].szPath), TEXT("%s,%d"), szPath, iIndex);
402 bUpdateIcon = TRUE;
403 }
404 }
405 else if (controlId == IDC_ICONS_SETDEFAULT)
406 {
407 i = pData->iLocalCurIcon;
408
409 StringCchCopy(pData->LocalIcon[i].szPath, _countof(pData->LocalIcon[i].szPath), pData->DefIcon[i].szPath);
410 bUpdateIcon = TRUE;
411 }
412
413 if (bUpdateIcon)
414 {
415 HWND hwndList = GetDlgItem(hwndDlg, IDC_ICONS_LISTVIEW);
416 HICON hIcon;
417
418 hIcon = GetIconFromLocation(pData->LocalIcon[i].szPath);
419
420 if (hIcon)
421 {
422 if (pData->hLocalImageList)
423 ImageList_ReplaceIcon(pData->hLocalImageList, i, hIcon);
425 }
426
427 pData->bLocalSettingsChanged =
428 pData->bLocalIconChanged[i] = TRUE;
429
430 InvalidateRect(hwndList, NULL, TRUE);
431 SetFocus(hwndList);
432 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
433 }
434 }
435 break;
436 }
437
438 case WM_NOTIFY:
439 {
441
442 switch (nm->hdr.code)
443 {
444 case LVN_ITEMCHANGED:
445 {
446 if ((nm->uNewState & LVIS_SELECTED) == 0)
447 return FALSE;
448
449 pData->iLocalCurIcon = nm->iItem;
450 break;
451 }
452 }
453 break;
454 }
455 }
456
457 return FALSE;
458}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct _DESKTOP_DATA * PDESKTOP_DATA
#define TRUE
Definition: types.h:120
static VOID DesktopOnInitDialog(IN HWND hwndDlg, IN PDESKTOP_DATA pData)
Definition: desktop.c:240
static VOID DesktopOnDestroyDialog(IN HWND hwndDlg, IN PDESKTOP_DATA pData)
Definition: desktop.c:325
#define IDC_ICONS_SETDEFAULT
Definition: resource.h:191
#define IDC_ICONS_CHANGEICON
Definition: resource.h:190
INT WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, INT nIndex, HICON hIcon)
Definition: imagelist.c:2779
BOOL WINAPI PickIconDlg(HWND hWndOwner, LPWSTR lpstrFile, UINT nMaxFile, INT *lpdwIconIndex)
Definition: dialogs.cpp:362
LPCWSTR szPath
Definition: env.c:37
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define LPPROPSHEETPAGE
Definition: prsht.h:390
struct tagNMLISTVIEW * LPNMLISTVIEW
#define LVN_ITEMCHANGED
Definition: commctrl.h:3131
#define WM_NOTIFY
Definition: richedit.h:61
#define PathUnExpandEnvStrings
Definition: shlwapi.h:1141
#define PathParseIconLocation
Definition: shlwapi.h:991
#define StringCchPrintf
Definition: strsafe.h:517
UINT code
Definition: winuser.h:3159
UINT uNewState
Definition: commctrl.h:3036
#define GetWindowLongPtr
Definition: treelist.c:73
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
#define ExpandEnvironmentStrings
Definition: winbase.h:3709
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
HWND WINAPI SetFocus(_In_opt_ HWND)
HWND WINAPI GetParent(_In_ HWND)
#define BN_CLICKED
Definition: winuser.h:1925
#define WM_DESTROY
Definition: winuser.h:1609
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

◆ GetCurrentValue()

static BOOL GetCurrentValue ( UINT  i,
BOOL  bNewStart 
)
static

Definition at line 158 of file desktop.c.

159{
160 TCHAR regPath[MAX_PATH];
161
162 StringCchCopy(regPath, _countof(regPath), szHideDesktopIcons);
163 StringCchCat(regPath, _countof(regPath), bNewStart ? szNewStartPanel : szClassicStartMenu);
164
165 return SHRegGetBoolUSValue(regPath, DesktopIcons[i].CLSID, FALSE, bNewStart);
166}
static const TCHAR szClassicStartMenu[]
Definition: desktop.c:30
static const TCHAR szNewStartPanel[]
Definition: desktop.c:31
static const TCHAR szHideDesktopIcons[]
Definition: desktop.c:29
#define SHRegGetBoolUSValue
Definition: shlwapi.h:574

Referenced by SetDesktopSettings().

◆ GetIconFromLocation()

static HICON GetIconFromLocation ( LPTSTR  szIconPath)
static

Definition at line 229 of file desktop.c.

230{
231 INT iIndex;
233
236 return ExtractIcon(hApplet, szPath, iIndex);
237}
HINSTANCE hApplet
Definition: access.c:17
#define ExtractIcon
Definition: shellapi.h:688

Referenced by DesktopOnInitDialog(), and DesktopPageProc().

◆ InitDesktopSettings()

VOID InitDesktopSettings ( PDESKTOP_DATA  pData)

Definition at line 63 of file desktop.c.

64{
65 UINT i;
66 TCHAR regPath[MAX_PATH];
67
68 /* Load desktop icon settings from the registry */
69 StringCchCopy(regPath, _countof(regPath), szHideDesktopIcons);
70 StringCchCat(regPath, _countof(regPath), szClassicStartMenu);
71
72 for (i = 0; i < _countof(pData->optIcons); i++)
73 {
74 pData->optIcons[i].bHideClassic = SHRegGetBoolUSValue(regPath, DesktopIcons[i].CLSID, FALSE, FALSE);
75 }
76
77 StringCchCopy(regPath, _countof(regPath), szHideDesktopIcons);
78 StringCchCat(regPath, _countof(regPath), szNewStartPanel);
79
80 for (i = 0; i < _countof(pData->optIcons); i++)
81 {
82 pData->optIcons[i].bHideNewStart = SHRegGetBoolUSValue(regPath, DesktopIcons[i].CLSID, FALSE, TRUE);
83 }
84
85 for (i = 0; i < _countof(IconChange); i++)
86 {
87 DWORD cbData, dwType;
88 TCHAR szData[MAX_PATH];
89
90 /* Current icons */
91 StringCchCopy(regPath, _countof(regPath), szUserClass);
92 StringCchCat(regPath, _countof(regPath), IconChange[i].CLSID);
93 StringCchCat(regPath, _countof(regPath), szDefaultIcon);
94 cbData = sizeof(szData);
95
96 if (SHGetValue(HKEY_CURRENT_USER, regPath, IconChange[i].IconName, &dwType,
97 &szData, &cbData) == ERROR_SUCCESS &&
98 (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
99 {
100 StringCchCopy(pData->Icon[i].szPath, _countof(pData->Icon[i].szPath), szData);
101 }
102
103 /* Default icons */
104 /* FIXME: Get default icons from theme data, fallback to CLSID data on error. */
105 StringCchCopy(regPath, _countof(regPath), szSysClass);
106 StringCchCat(regPath, _countof(regPath), IconChange[i].CLSID);
107 StringCchCat(regPath, _countof(regPath), szDefaultIcon);
108 cbData = sizeof(szData);
109
110 if (SHGetValue(HKEY_CLASSES_ROOT, regPath, IconChange[i].IconName, &dwType,
111 &szData, &cbData) == ERROR_SUCCESS &&
112 (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
113 {
114 StringCchCopy(pData->DefIcon[i].szPath, _countof(pData->DefIcon[i].szPath), szData);
115 }
116
117 /* Emergency fallback */
118 if (lstrlen(pData->DefIcon[i].szPath) == 0)
119 StringCchCopy(pData->DefIcon[i].szPath, _countof(pData->DefIcon[i].szPath), szFallbackIcon);
120
121 if (lstrlen(pData->Icon[i].szPath) == 0)
122 StringCchCopy(pData->Icon[i].szPath, _countof(pData->Icon[i].szPath), pData->DefIcon[i].szPath);
123 }
124}
static const TCHAR szDefaultIcon[]
Definition: desktop.c:46
static const TCHAR szSysClass[]
Definition: desktop.c:45
static const TCHAR szFallbackIcon[]
Definition: desktop.c:47
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define lstrlen
Definition: winbase.h:3811
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by BackgroundPageProc().

◆ SaveDesktopSettings()

BOOL SaveDesktopSettings ( PDESKTOP_DATA  pData)

Definition at line 127 of file desktop.c.

128{
129 UINT i;
130
131 if (!pData->bLocalSettingsChanged)
132 return FALSE;
133
134 for (i = 0; i < _countof(DesktopIcons); i++)
135 {
136 if (!pData->bLocalHideChanged[i])
137 continue;
138
139 pData->optIcons[i].bHideClassic =
140 pData->optIcons[i].bHideNewStart = pData->bLocalHideIcon[i];
141 pData->bHideChanged[i] = TRUE;
142 }
143
144 for (i = 0; i < _countof(IconChange); i++)
145 {
146 if (!pData->bLocalIconChanged[i])
147 continue;
148
149 StringCchCopy(pData->Icon[i].szPath, _countof(pData->Icon[i].szPath), pData->LocalIcon[i].szPath);
150 pData->bIconChanged[i] = TRUE;
151 }
152
153 pData->bSettingsChanged = TRUE;
154 return TRUE;
155}

Referenced by OnCustomButton().

◆ SetCurrentValue()

static VOID SetCurrentValue ( UINT  i,
BOOL  bNewStart,
BOOL  bValue 
)
static

Definition at line 169 of file desktop.c.

170{
171 TCHAR regPath[MAX_PATH];
172
173 StringCchCopy(regPath, _countof(regPath), szHideDesktopIcons);
174 StringCchCat(regPath, _countof(regPath), bNewStart ? szNewStartPanel : szClassicStartMenu);
175
177 (LPBYTE)&bValue, sizeof(bValue));
178}
#define REG_DWORD
Definition: sdbapi.c:596
#define SHSetValue
Definition: shlwapi.h:92
unsigned char * LPBYTE
Definition: typedefs.h:53

Referenced by SetDesktopSettings().

◆ SetDesktopSettings()

VOID SetDesktopSettings ( PDESKTOP_DATA  pData)

Definition at line 181 of file desktop.c.

182{
183 UINT i;
184
185 for (i = 0; i < _countof(DesktopIcons); i++)
186 {
187 if (!pData->bHideChanged[i])
188 continue;
189
190 if (GetCurrentValue(i, FALSE) != pData->optIcons[i].bHideClassic)
191 SetCurrentValue(i, FALSE, pData->optIcons[i].bHideClassic);
192
193 if (GetCurrentValue(i, TRUE) != pData->optIcons[i].bHideNewStart)
194 SetCurrentValue(i, TRUE, pData->optIcons[i].bHideNewStart);
195
196 pData->bHideChanged[i] = FALSE;
197 }
198
199 for (i = 0; i < _countof(IconChange); i++)
200 {
201 TCHAR iconPath[MAX_PATH];
202 DWORD dwType = (pData->Icon[i].szPath[0] == TEXT('%') ? REG_EXPAND_SZ : REG_SZ);
203
204 if (!pData->bIconChanged[i])
205 continue;
206
207 StringCchCopy(iconPath, _countof(iconPath), szUserClass);
208 StringCchCat(iconPath, _countof(iconPath), IconChange[i].CLSID);
209 StringCchCat(iconPath, _countof(iconPath), szDefaultIcon);
210
212 pData->Icon[i].szPath, sizeof(pData->Icon[i].szPath));
214 {
215 /* Also apply to the root value */
216 SHSetValue(HKEY_CURRENT_USER, iconPath, NULL, dwType,
217 pData->Icon[i].szPath, sizeof(pData->Icon[i].szPath));
218 }
219 pData->bIconChanged[i] = FALSE;
220 }
221
222 pData->bSettingsChanged = FALSE;
223
224 /* Refresh the desktop */
226}
static VOID SetCurrentValue(UINT i, BOOL bNewStart, BOOL bValue)
Definition: desktop.c:169
#define IDS_TITLE_BIN_0
Definition: desktop.c:19
static BOOL GetCurrentValue(UINT i, BOOL bNewStart)
Definition: desktop.c:158
#define FCIDM_DESKBROWSER_REFRESH
Definition: desktop.c:14
HWND WINAPI GetShellWindow(VOID)
Definition: desktop.c:651
#define PostMessage
Definition: winuser.h:5832

Referenced by BackgroundPageProc().

Variable Documentation

◆ Checkbox

UINT Checkbox

Definition at line 36 of file desktop.c.

Referenced by DesktopOnInitDialog(), and DesktopPageProc().

◆ CLSID

Definition at line 35 of file desktop.c.

◆ 

struct { ... } DesktopIcons[NUM_DESKTOP_ICONS]
Initial value:
= {
{TEXT("{450D8FBA-AD25-11D0-98A8-0800361B1103}"), IDC_ICONS_MYDOCS},
{TEXT("{208D2C60-3AEA-1069-A2D7-08002B30309D}"), IDC_ICONS_MYNET},
{TEXT("{20D04FE0-3AEA-1069-A2D8-08002B30309D}"), IDC_ICONS_MYCOMP},
{TEXT("{871C5380-42A0-1069-A2EA-08002B30309D}"), IDC_ICONS_INTERNET},
}
#define IDC_ICONS_INTERNET
Definition: resource.h:188
#define IDC_ICONS_MYCOMP
Definition: resource.h:187
#define IDC_ICONS_MYDOCS
Definition: resource.h:185
#define IDC_ICONS_MYNET
Definition: resource.h:186

Referenced by DesktopOnInitDialog(), DesktopPageProc(), GetCurrentValue(), InitDesktopSettings(), SaveDesktopSettings(), SetCurrentValue(), and SetDesktopSettings().

◆ 

struct { ... } IconChange[NUM_CHANGE_ICONS]
Initial value:
= {
{TEXT("{20D04FE0-3AEA-1069-A2D8-08002B30309D}"), IDS_TITLE_MYCOMP, NULL},
{TEXT("{450D8FBA-AD25-11D0-98A8-0800361B1103}"), IDS_PERSONAL, NULL},
{TEXT("{208D2C60-3AEA-1069-A2D7-08002B30309D}"), IDS_TITLE_MYNET, NULL},
{TEXT("{645FF040-5081-101B-9F08-00AA002F954E}"), IDS_TITLE_BIN_1, TEXT("Full")},
{TEXT("{645FF040-5081-101B-9F08-00AA002F954E}"), IDS_TITLE_BIN_0, TEXT("Empty")},
}
#define IDS_TITLE_MYNET
Definition: desktop.c:17
#define IDS_TITLE_MYCOMP
Definition: desktop.c:16
#define IDS_TITLE_BIN_1
Definition: desktop.c:18
#define IDS_PERSONAL
Definition: desktop.c:27

Referenced by DesktopOnInitDialog(), InitDesktopSettings(), SaveDesktopSettings(), and SetDesktopSettings().

◆ IconName

◆ szClassicStartMenu

const TCHAR szClassicStartMenu[] = TEXT("ClassicStartMenu")
static

Definition at line 30 of file desktop.c.

Referenced by GetCurrentValue(), InitDesktopSettings(), and SetCurrentValue().

◆ szDefaultIcon

const TCHAR szDefaultIcon[] = TEXT("\\DefaultIcon")
static

Definition at line 46 of file desktop.c.

Referenced by InitDesktopSettings(), and SetDesktopSettings().

◆ szFallbackIcon

const TCHAR szFallbackIcon[] = TEXT("%SystemRoot%\\system32\\shell32.dll,0")
static

Definition at line 47 of file desktop.c.

Referenced by InitDesktopSettings().

◆ szHideDesktopIcons

const TCHAR szHideDesktopIcons[] = TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\HideDesktopIcons\\")
static

Definition at line 29 of file desktop.c.

Referenced by GetCurrentValue(), InitDesktopSettings(), and SetCurrentValue().

◆ szNewStartPanel

const TCHAR szNewStartPanel[] = TEXT("NewStartPanel")
static

Definition at line 31 of file desktop.c.

Referenced by GetCurrentValue(), InitDesktopSettings(), and SetCurrentValue().

◆ szSysClass

const TCHAR szSysClass[] = TEXT("CLSID\\")
static

Definition at line 45 of file desktop.c.

Referenced by InitDesktopSettings().

◆ szUserClass

const TCHAR szUserClass[] = TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\")
static

Definition at line 44 of file desktop.c.

Referenced by DesktopOnInitDialog(), InitDesktopSettings(), and SetDesktopSettings().

◆ TitleId

UINT TitleId

Definition at line 52 of file desktop.c.

Referenced by ConfirmDialog(), DesktopOnInitDialog(), and SetDesktopSettings().