From c5bfeaf01ec81be91cff92089394f213536a6743 Mon Sep 17 00:00:00 2001 From: St0RM53 Date: Sat, 21 Nov 2026 01:10:53 +0200 Subject: [PATCH] Add option to open the Control Panel in the category view New ControlPanelCategory option: when enabled, activating the Control Panel item opens the category view home ({26EE0668-A00A-44D7-9371- BEB064C98683}) instead of All Control Panel Items. Off by default; behavior is unchanged otherwise. --- Src/StartMenu/StartMenuDLL/MenuCommands.cpp | 33 +++++++++++++++++++++ Src/StartMenu/StartMenuDLL/SettingsUI.cpp | 1 + Src/StartMenu/StartMenuDLL/StartMenuDLL.rc | 2 ++ Src/StartMenu/StartMenuDLL/resource.h | 3 ++ 4 files changed, 39 insertions(+) diff --git a/Src/StartMenu/StartMenuDLL/MenuCommands.cpp b/Src/StartMenu/StartMenuDLL/MenuCommands.cpp index ac35f04f7..4af47c356 100644 --- a/Src/StartMenu/StartMenuDLL/MenuCommands.cpp +++ b/Src/StartMenu/StartMenuDLL/MenuCommands.cpp @@ -214,6 +214,19 @@ void CMenuContainer::ExecuteCommand( const wchar_t *command, bool bElevated, boo } } +// Opens the Control Panel in the category view (ControlPanelCategory setting) +static void OpenControlPanelCategory( void ) +{ + // the category view home is the {26EE0668-A00A-44D7-9371-BEB064C98683} shell folder + CAbsolutePidl pidl; + if (FAILED(SHParseDisplayName(L"::{26EE0668-A00A-44D7-9371-BEB064C98683}",NULL,&pidl,0,NULL))) + return; + SHELLEXECUTEINFO execute={sizeof(execute),SEE_MASK_IDLIST|SEE_MASK_FLAG_LOG_USAGE}; + execute.lpIDList=pidl; + execute.nShow=SW_SHOWNORMAL; + ShellExecuteEx(&execute); +} + // Dialog proc for the Log Off dialog box static INT_PTR CALLBACK LogOffDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) { @@ -1576,6 +1589,26 @@ void CMenuContainer::ActivateItem( int index, TActivateType type, const POINT *p if (item.id==MENU_EMPTY || item.id==MENU_EMPTY_TOP) return; if (item.bFolder && pItemPidl1 && !item.bSplit && !GetSettingBool(L"EnableExplorer")) return; + // open the Control Panel in the category view if enabled (ControlPanelCategory setting) + if (GetSettingBool(L"ControlPanelCategory") && (pItemPidl1 || pItemPidl2)) + { + CAbsolutePidl pidlCP; + if (SUCCEEDED(ShGetKnownFolderIDList(FOLDERID_ControlPanelFolder,&pidlCP)) && + ((pItemPidl1 && ILIsEqual(pItemPidl1,pidlCP)) || (pItemPidl2 && ILIsEqual(pItemPidl2,pidlCP)))) + { + if (bKeepOpen) + LockSetForegroundWindow(LSFW_LOCK); + else + { + LockSetForegroundWindow(LSFW_UNLOCK); + FadeOutItem(index); + CloseSubMenus(CLOSE_POST,NULL); + } + PlayMenuSound(SOUND_COMMAND); + OpenControlPanelCategory(); + return; + } + } if (item.id==MENU_SEARCH_BOX) { // the search button was pressed diff --git a/Src/StartMenu/StartMenuDLL/SettingsUI.cpp b/Src/StartMenu/StartMenuDLL/SettingsUI.cpp index af9376103..6382fcf6e 100644 --- a/Src/StartMenu/StartMenuDLL/SettingsUI.cpp +++ b/Src/StartMenu/StartMenuDLL/SettingsUI.cpp @@ -4337,6 +4337,7 @@ CSetting g_Settings[]={ {L"Date",CSetting::TYPE_RADIO,IDS_SORT_DATE,IDS_SORT_DATE_TIP}, {L"StartScreenShortcut",CSetting::TYPE_BOOL,IDS_STARTSCREEN_ITEM,IDS_STARTSCREEN_ITEM_TIP,1}, {L"ControlPanelCategories2",CSetting::TYPE_BOOL,IDS_CP_CATEGORIES2,IDS_CP_CATEGORIES_TIP,0,CSetting::FLAG_MENU_WIN7}, + {L"ControlPanelCategory",CSetting::TYPE_BOOL,IDS_CP_VIEW,IDS_CP_VIEW_TIP,0}, {L"MainSortZA",CSetting::TYPE_BOOL,IDS_MAIN_SORTZA,IDS_SORTZA_TIP,0}, {L"MainSortOnce",CSetting::TYPE_BOOL,IDS_MAIN_SORTONCE,IDS_SORTONCE_TIP,0}, diff --git a/Src/StartMenu/StartMenuDLL/StartMenuDLL.rc b/Src/StartMenu/StartMenuDLL/StartMenuDLL.rc index d65ffce32..40ded262b 100644 --- a/Src/StartMenu/StartMenuDLL/StartMenuDLL.rc +++ b/Src/StartMenu/StartMenuDLL/StartMenuDLL.rc @@ -1045,6 +1045,8 @@ BEGIN IDS_SEARCH_MAX_TIP2 "Limit the number of results shown per category" IDS_SEARCH_MAX3 "Results per maximized category" IDS_SEARCH_MAX_TIP3 "Limit the number of results shown for the maximized category" + IDS_CP_VIEW "Open Control Panel in Category view" + IDS_CP_VIEW_TIP "Open the Control Panel in the category view instead of the icon view" IDS_SHOW_APPS "Show Metro apps" IDS_SHOW_APPS_TIP "When this is checked, the programs tree will include a folder for the Metro apps" IDS_FOLDERS_FIRST "Show folders first" diff --git a/Src/StartMenu/StartMenuDLL/resource.h b/Src/StartMenu/StartMenuDLL/resource.h index 81acb7478..5595f843d 100644 --- a/Src/StartMenu/StartMenuDLL/resource.h +++ b/Src/StartMenu/StartMenuDLL/resource.h @@ -846,6 +846,9 @@ #define IDS_STRING7110 7110 #define IDS_STRING7111 7111 +#define IDS_CP_VIEW 3700 +#define IDS_CP_VIEW_TIP 3701 + // Next default values for new objects // #ifdef APSTUDIO_INVOKED