diff --git a/Src/Lib/SettingsUIHelper.cpp b/Src/Lib/SettingsUIHelper.cpp index 66d10ab..cbe9218 100644 --- a/Src/Lib/SettingsUIHelper.cpp +++ b/Src/Lib/SettingsUIHelper.cpp @@ -140,10 +140,8 @@ void EnableSettingsTreeAccessibility( HWND tree ) server->Release(); } -void ClearSettingsTreeItemAccessibility( HWND tree ) +static void ClearSettingsTreeItemAccessibilityImpl( IAccPropServices *props, HWND tree ) { - CComPtr props; - if (FAILED(CoCreateInstance(CLSID_SettingsAccPropServices,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&props)))) return; MSAAPROPID properties[]={PROPID_SettingsAccState,PROPID_SettingsAccName,PROPID_SettingsAccRole}; for (HTREEITEM item=TreeView_GetRoot(tree);item;) { @@ -159,6 +157,27 @@ void ClearSettingsTreeItemAccessibility( HWND tree ) } } +void ClearSettingsTreeItemAccessibility( HWND tree ) +{ + if (!tree || !IsWindow(tree)) return; + CComPtr props; + if (FAILED(CoCreateInstance(CLSID_SettingsAccPropServices,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&props)))) return; + ClearSettingsTreeItemAccessibilityImpl(props,tree); +} + +void ClearSettingsTreeAccessibility( HWND tree ) +{ + if (!tree || !IsWindow(tree)) return; + CComPtr props; + if (FAILED(CoCreateInstance(CLSID_SettingsAccPropServices,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&props)))) return; + + // Release all per-item servers while their accessibility IDs can still be + // resolved, then remove the container server and the tree-level name. + ClearSettingsTreeItemAccessibilityImpl(props,tree); + MSAAPROPID properties[]={PROPID_SettingsAccState,PROPID_SettingsAccName,PROPID_SettingsAccRole}; + props->ClearHwndProps(tree,OBJID_CLIENT,CHILDID_SELF,properties,_countof(properties)); +} + void SetControlAccessibleName( HWND control, const wchar_t *name ) { CComPtr props; @@ -2778,6 +2797,7 @@ LRESULT CTreeSettingsDlg::OnInitDialog( UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT CTreeSettingsDlg::OnDestroy( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled ) { + ClearSettingsTreeAccessibility(m_Tree); DestroyIcon(m_PlayIcon); bHandled=FALSE; m_EditMode=EDIT_NONE; diff --git a/Src/Lib/SettingsUIHelper.h b/Src/Lib/SettingsUIHelper.h index 0bdfa11..e85388b 100644 --- a/Src/Lib/SettingsUIHelper.h +++ b/Src/Lib/SettingsUIHelper.h @@ -19,6 +19,7 @@ struct CSetting; // by Open-Shell's existing image list. void EnableSettingsTreeAccessibility( HWND tree ); void ClearSettingsTreeItemAccessibility( HWND tree ); +void ClearSettingsTreeAccessibility( HWND tree ); void SetControlAccessibleName( HWND control, const wchar_t *name ); void SetSettingsTreeAccessibleName( HWND tree, const wchar_t *name ); void SetSettingsTreeItemAccessibleName( HWND tree, HTREEITEM item, const wchar_t *name ); diff --git a/Src/StartMenu/StartMenuDLL/SettingsUI.cpp b/Src/StartMenu/StartMenuDLL/SettingsUI.cpp index 2af34bd..072f4e2 100644 --- a/Src/StartMenu/StartMenuDLL/SettingsUI.cpp +++ b/Src/StartMenu/StartMenuDLL/SettingsUI.cpp @@ -285,6 +285,7 @@ LRESULT CSkinSettingsDlg::OnInitDialog( UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT CSkinSettingsDlg::OnDestroy( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled ) { + ClearSettingsTreeAccessibility(m_Tree); m_EditMode=SKIN_OPTION_NONE; bHandled=FALSE; return 0;