4 * Copyright 2006 - 2007 Thomas Weidenmueller <w3seek@reactos.org>
5 * 2015 Robert Naumann <gonzomdx@gmail.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 // TODO: Windows Explorer appears to be calling NewLinkHere / ConfigStartMenu directly for both items.
25 VOID
OnAddStartMenuItems(HWND hDlg
)
27 WCHAR szPath
[MAX_PATH
];
29 if (SUCCEEDED(SHGetFolderPathW(NULL
, CSIDL_STARTMENU
, NULL
, 0, szPath
)))
31 WCHAR szCommand
[MAX_PATH
] = L
"appwiz.cpl,NewLinkHere ";
32 if (SUCCEEDED(StringCchCatW(szCommand
, _countof(szCommand
), szPath
)))
33 ShellExecuteW(hDlg
, L
"open", L
"rundll32.exe", szCommand
, NULL
, SW_SHOWNORMAL
);
37 VOID
OnRemoveStartmenuItems(HWND hDlg
)
39 ShellExecuteW(hDlg
, L
"open", L
"rundll32.exe", L
"appwiz.cpl,ConfigStartMenu", NULL
, SW_SHOWNORMAL
);
42 VOID
OnAdvancedStartMenuItems()
44 WCHAR szPath
[MAX_PATH
];
46 if (SUCCEEDED(SHGetFolderPathW(NULL
, CSIDL_STARTMENU
, NULL
, 0, szPath
)))
48 ShellExecuteW(NULL
, L
"explore", szPath
, NULL
, NULL
, SW_SHOWNORMAL
);
52 VOID
OnClearRecentItems()
54 WCHAR szPath
[MAX_PATH
], szFile
[MAX_PATH
];
55 WIN32_FIND_DATAW info
;
58 if (SUCCEEDED(SHGetFolderPathW(NULL
, CSIDL_RECENT
, NULL
, 0, szPath
)))
60 StringCchPrintfW(szFile
, _countof(szFile
), L
"%s\\*.*", szPath
);
61 hPath
= FindFirstFileW(szFile
, &info
);
64 StringCchPrintfW(szFile
, _countof(szFile
), L
"%s\\%s", szPath
, info
.cFileName
);
67 while (FindNextFileW(hPath
, &info
));
69 /* FIXME: Disable the button*/
73 INT_PTR CALLBACK
CustomizeClassicProc(HWND hwnd
, UINT Message
, WPARAM wParam
, LPARAM lParam
)
78 /* FIXME: Properly initialize the dialog (check whether 'clear' button must be disabled, for example) */
81 switch(LOWORD(wParam
))
83 case IDC_CLASSICSTART_ADD
:
84 OnAddStartMenuItems(hwnd
);
86 case IDC_CLASSICSTART_REMOVE
:
87 OnRemoveStartmenuItems(hwnd
);
89 case IDC_CLASSICSTART_ADVANCED
:
90 OnAdvancedStartMenuItems();
92 case IDC_CLASSICSTART_CLEAR
:
96 EndDialog(hwnd
, IDOK
);
99 EndDialog(hwnd
, IDCANCEL
);
109 VOID
ShowCustomizeClassic(HINSTANCE hInst
, HWND hExplorer
)
111 DialogBoxW(hInst
, MAKEINTRESOURCEW(IDD_CLASSICSTART_CUSTOMIZE
), hExplorer
, CustomizeClassicProc
);