Skip to content

Commit 2f251c4

Browse files
committed
Separate taskbar icon for Open-Shell menu settings dialog
It will be now separate from Explorer's icons in taskbar. Open-Shell icon will be displayed for better clarity. #31 (comment)
1 parent d2985ba commit 2f251c4

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

Src/Lib/Settings.cpp

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <Uxtheme.h>
1414
#include <VSStyle.h>
1515
#include <propkey.h>
16+
#include <propvarutil.h>
1617
#include <htmlhelp.h>
1718
#include <vector>
1819
#include <map>
@@ -1108,7 +1109,7 @@ class CSettingsDlg: public CResizeableDlg<CSettingsDlg>
11081109
{
11091110
public:
11101111
CSettingsDlg( void );
1111-
void Init( CSetting *pSettings, ICustomSettings *pCustom, int tab );
1112+
void Init( CSetting *pSettings, ICustomSettings *pCustom, int tab, const wchar_t* appId );
11121113

11131114
BEGIN_MSG_MAP( CSettingsDlg )
11141115
MESSAGE_HANDLER( WM_INITDIALOG, OnInitDialog )
@@ -1182,6 +1183,7 @@ class CSettingsDlg: public CResizeableDlg<CSettingsDlg>
11821183
bool m_bIgnoreEdit;
11831184
bool m_bDirty;
11841185
CString m_FilterText;
1186+
const wchar_t* m_AppId;
11851187

11861188
void AddTabs( int name, const CSetting *pSelect=NULL );
11871189
void SetCurTab( int index, bool bReset, const CSetting *pSelect=NULL );
@@ -1214,15 +1216,17 @@ CSettingsDlg::CSettingsDlg( void )
12141216
m_bOnTop=false;
12151217
m_bIgnoreEdit=false;
12161218
m_bDirty=false;
1219+
m_AppId=NULL;
12171220
}
12181221

1219-
void CSettingsDlg::Init( CSetting *pSettings, ICustomSettings *pCustom, int tab )
1222+
void CSettingsDlg::Init( CSetting *pSettings, ICustomSettings *pCustom, int tab, const wchar_t* appId )
12201223
{
12211224
m_pSettings=pSettings;
12221225
m_pCustom=pCustom;
12231226
m_InitialTab=tab;
12241227
m_FilterText.Empty();
12251228
m_bDirty=false;
1229+
m_AppId=appId;
12261230
}
12271231

12281232
// Subclass the tooltip to delay the tip when the mouse moves from one tree item to the next
@@ -1246,17 +1250,19 @@ LRESULT CSettingsDlg::OnInitDialog( UINT uMsg, WPARAM wParam, LPARAM lParam, BOO
12461250
#ifdef _DEBUG
12471251
g_bUIThread=true;
12481252
#endif
1249-
/*
1250-
// attempt to make the dialog have its own icon. doesn't work though. the icon changes, but to the default folder icon
1251-
CComPtr<IPropertyStore> pStore;
1252-
if (SUCCEEDED(SHGetPropertyStoreForWindow(m_hWnd,IID_IPropertyStore,(void**)&pStore)))
1253+
1254+
if (m_AppId)
12531255
{
1254-
PROPVARIANT val;
1255-
val.vt=VT_LPWSTR;
1256-
val.pwszVal=L"OpenShell.Settings.Dialog";
1257-
pStore->SetValue(PKEY_AppUserModel_ID,val);
1256+
// attempt to make the dialog have its own icon
1257+
CComPtr<IPropertyStore> pStore;
1258+
if (SUCCEEDED(SHGetPropertyStoreForWindow(m_hWnd,IID_IPropertyStore,(void**)&pStore)))
1259+
{
1260+
PROPVARIANT val;
1261+
InitPropVariantFromString(m_AppId,&val);
1262+
pStore->SetValue(PKEY_AppUserModel_ID,val);
1263+
}
12581264
}
1259-
*/
1265+
12601266
InitResize(MOVE_MODAL);
12611267
HMENU menu=GetSystemMenu(FALSE);
12621268
bool bAdded=false;
@@ -1840,7 +1846,7 @@ bool CSettingsDlg::IsTabValid( void )
18401846

18411847
static CSettingsDlg g_SettingsDlg;
18421848

1843-
void EditSettings( const wchar_t *title, bool bModal, int tab )
1849+
void EditSettings( const wchar_t *title, bool bModal, int tab, const wchar_t* appId )
18441850
{
18451851
if (g_SettingsDlg.m_hWnd)
18461852
{
@@ -1858,7 +1864,7 @@ void EditSettings( const wchar_t *title, bool bModal, int tab )
18581864
}
18591865
DLGTEMPLATE *pTemplate=LoadDialogEx(IDD_SETTINGS);
18601866
g_SettingsManager.ResetImageList();
1861-
g_SettingsDlg.Init(g_SettingsManager.GetSettings(),g_SettingsManager.GetCustom(),tab);
1867+
g_SettingsDlg.Init(g_SettingsManager.GetSettings(),g_SettingsManager.GetCustom(),tab,appId);
18621868
g_SettingsDlg.Create(NULL,pTemplate);
18631869
g_SettingsDlg.SetWindowText(title);
18641870
g_SettingsDlg.SetWindowPos(HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|(g_SettingsDlg.GetOnTop()?0:SWP_NOZORDER)|SWP_SHOWWINDOW);

Src/Lib/Settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void InitSettings( CSetting *pSettings, TSettingsComponent component, ICustomSet
129129
void LoadSettings( void );
130130
void SaveSettings( void );
131131
void UpdateDefaultSettings( void );
132-
void EditSettings( const wchar_t *title, bool bModal, int tab );
132+
void EditSettings( const wchar_t *title, bool bModal, int tab, const wchar_t *appId = nullptr );
133133
void CloseSettings( void );
134134
void SetSettingsDirty( void );
135135
void SelectSettingsTab( int tab, bool bAdvanced, const CSetting *pSelect );

Src/StartMenu/StartMenuDLL/SettingsUI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5272,7 +5272,7 @@ void EditSettings( bool bModal, int tab )
52725272
Sprintf(title,_countof(title),LoadStringEx(IDS_SETTINGS_TITLE_VER),ver>>24,(ver>>16)&0xFF,ver&0xFFFF);
52735273
else
52745274
Sprintf(title,_countof(title),LoadStringEx(IDS_SETTINGS_TITLE));
5275-
EditSettings(title,bModal,tab);
5275+
EditSettings(title,bModal,tab,L"OpenShell.StartMenu.Settings");
52765276
}
52775277

52785278
bool DllImportSettingsXml( const wchar_t *fname )

0 commit comments

Comments
 (0)