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{
11091110public:
11101111CSettingsDlg ( void );
1111- void Init ( CSetting *pSettings, ICustomSettings *pCustom, int tab );
1112+ void Init ( CSetting *pSettings, ICustomSettings *pCustom, int tab, const wchar_t * appId );
11121113
11131114BEGIN_MSG_MAP ( CSettingsDlg )
11141115MESSAGE_HANDLER ( WM_INITDIALOG, OnInitDialog )
@@ -1182,6 +1183,7 @@ class CSettingsDlg: public CResizeableDlg<CSettingsDlg>
11821183bool m_bIgnoreEdit;
11831184bool m_bDirty;
11841185CString m_FilterText;
1186+ const wchar_t * m_AppId;
11851187
11861188void AddTabs ( int name, const CSetting *pSelect=NULL );
11871189void SetCurTab ( int index, bool bReset, const CSetting *pSelect=NULL );
@@ -1214,15 +1216,17 @@ CSettingsDlg::CSettingsDlg( void )
12141216m_bOnTop=false ;
12151217m_bIgnoreEdit=false ;
12161218m_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{
12211224m_pSettings=pSettings;
12221225m_pCustom=pCustom;
12231226m_InitialTab=tab;
12241227m_FilterText.Empty ();
12251228m_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
12471251g_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+
12601266InitResize (MOVE_MODAL);
12611267HMENU menu=GetSystemMenu (FALSE );
12621268bool bAdded=false ;
@@ -1840,7 +1846,7 @@ bool CSettingsDlg::IsTabValid( void )
18401846
18411847static 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{
18451851if (g_SettingsDlg.m_hWnd )
18461852{
@@ -1858,7 +1864,7 @@ void EditSettings( const wchar_t *title, bool bModal, int tab )
18581864}
18591865DLGTEMPLATE *pTemplate=LoadDialogEx (IDD_SETTINGS);
18601866g_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 );
18621868g_SettingsDlg.Create (NULL ,pTemplate);
18631869g_SettingsDlg.SetWindowText (title);
18641870g_SettingsDlg.SetWindowPos (HWND_TOPMOST,0 ,0 ,0 ,0 ,SWP_NOSIZE|SWP_NOMOVE|(g_SettingsDlg.GetOnTop ()?0 :SWP_NOZORDER)|SWP_SHOWWINDOW);
0 commit comments