diff --git a/Src/Lib/Settings.cpp b/Src/Lib/Settings.cpp index 54b3e27..97674f3 100644 --- a/Src/Lib/Settings.cpp +++ b/Src/Lib/Settings.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -1108,7 +1109,7 @@ class CSettingsDlg: public CResizeableDlg { public: CSettingsDlg( void ); - void Init( CSetting *pSettings, ICustomSettings *pCustom, int tab ); + void Init( CSetting *pSettings, ICustomSettings *pCustom, int tab, const wchar_t* appId ); BEGIN_MSG_MAP( CSettingsDlg ) MESSAGE_HANDLER( WM_INITDIALOG, OnInitDialog ) @@ -1182,6 +1183,7 @@ private: bool m_bIgnoreEdit; bool m_bDirty; CString m_FilterText; + const wchar_t* m_AppId; void AddTabs( int name, const CSetting *pSelect=NULL ); void SetCurTab( int index, bool bReset, const CSetting *pSelect=NULL ); @@ -1214,15 +1216,17 @@ CSettingsDlg::CSettingsDlg( void ) m_bOnTop=false; m_bIgnoreEdit=false; m_bDirty=false; + m_AppId=NULL; } -void CSettingsDlg::Init( CSetting *pSettings, ICustomSettings *pCustom, int tab ) +void CSettingsDlg::Init( CSetting *pSettings, ICustomSettings *pCustom, int tab, const wchar_t* appId ) { m_pSettings=pSettings; m_pCustom=pCustom; m_InitialTab=tab; m_FilterText.Empty(); m_bDirty=false; + m_AppId=appId; } // 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 #ifdef _DEBUG g_bUIThread=true; #endif -/* - // attempt to make the dialog have its own icon. doesn't work though. the icon changes, but to the default folder icon - CComPtr pStore; - if (SUCCEEDED(SHGetPropertyStoreForWindow(m_hWnd,IID_IPropertyStore,(void**)&pStore))) + + if (m_AppId) { - PROPVARIANT val; - val.vt=VT_LPWSTR; - val.pwszVal=L"OpenShell.Settings.Dialog"; - pStore->SetValue(PKEY_AppUserModel_ID,val); + // attempt to make the dialog have its own icon + CComPtr pStore; + if (SUCCEEDED(SHGetPropertyStoreForWindow(m_hWnd,IID_IPropertyStore,(void**)&pStore))) + { + PROPVARIANT val; + InitPropVariantFromString(m_AppId,&val); + pStore->SetValue(PKEY_AppUserModel_ID,val); + } } -*/ + InitResize(MOVE_MODAL); HMENU menu=GetSystemMenu(FALSE); bool bAdded=false; @@ -1840,7 +1846,7 @@ bool CSettingsDlg::IsTabValid( void ) static CSettingsDlg g_SettingsDlg; -void EditSettings( const wchar_t *title, bool bModal, int tab ) +void EditSettings( const wchar_t *title, bool bModal, int tab, const wchar_t* appId ) { if (g_SettingsDlg.m_hWnd) { @@ -1858,7 +1864,7 @@ void EditSettings( const wchar_t *title, bool bModal, int tab ) } DLGTEMPLATE *pTemplate=LoadDialogEx(IDD_SETTINGS); g_SettingsManager.ResetImageList(); - g_SettingsDlg.Init(g_SettingsManager.GetSettings(),g_SettingsManager.GetCustom(),tab); + g_SettingsDlg.Init(g_SettingsManager.GetSettings(),g_SettingsManager.GetCustom(),tab,appId); g_SettingsDlg.Create(NULL,pTemplate); g_SettingsDlg.SetWindowText(title); g_SettingsDlg.SetWindowPos(HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|(g_SettingsDlg.GetOnTop()?0:SWP_NOZORDER)|SWP_SHOWWINDOW); diff --git a/Src/Lib/Settings.h b/Src/Lib/Settings.h index 01b8f42..92fa88f 100644 --- a/Src/Lib/Settings.h +++ b/Src/Lib/Settings.h @@ -129,7 +129,7 @@ void InitSettings( CSetting *pSettings, TSettingsComponent component, ICustomSet void LoadSettings( void ); void SaveSettings( void ); void UpdateDefaultSettings( void ); -void EditSettings( const wchar_t *title, bool bModal, int tab ); +void EditSettings( const wchar_t *title, bool bModal, int tab, const wchar_t *appId = nullptr ); void CloseSettings( void ); void SetSettingsDirty( void ); void SelectSettingsTab( int tab, bool bAdvanced, const CSetting *pSelect ); diff --git a/Src/StartMenu/StartMenuDLL/SettingsUI.cpp b/Src/StartMenu/StartMenuDLL/SettingsUI.cpp index eb3af04..4938360 100644 --- a/Src/StartMenu/StartMenuDLL/SettingsUI.cpp +++ b/Src/StartMenu/StartMenuDLL/SettingsUI.cpp @@ -5272,7 +5272,7 @@ void EditSettings( bool bModal, int tab ) Sprintf(title,_countof(title),LoadStringEx(IDS_SETTINGS_TITLE_VER),ver>>24,(ver>>16)&0xFF,ver&0xFFFF); else Sprintf(title,_countof(title),LoadStringEx(IDS_SETTINGS_TITLE)); - EditSettings(title,bModal,tab); + EditSettings(title,bModal,tab,L"OpenShell.StartMenu.Settings"); } bool DllImportSettingsXml( const wchar_t *fname )