Accessibility — custom accessible names for controls.
Standard Win32 common controls (ListView, TreeView, Button, …) already expose
MSAA accessibility to screen readers such as JAWS and NVDA — items, roles and
navigation all work with no extra code. The one thing missing for controls
that lack a visible text label (for example a bare TreeView used as a category
panel) is a human-readable *name*.
setAccessibleName supplies one. Rather than implementing a full IAccessible
proxy and intercepting WM_GETOBJECT, it uses MSAA Direct Annotation
(IAccPropServices::SetHwndPropStr) to override just the name property on the
control's default accessible object. oleacc then serves that name through the
standard accessibility path automatically. This is the same mechanism WinForms
uses to implement Control.AccessibleName.
COM must be initialized on the calling (UI) thread first — Application.initialize
does this.
Accessibility — custom accessible names for controls.
Standard Win32 common controls (ListView, TreeView, Button, …) already expose MSAA accessibility to screen readers such as JAWS and NVDA — items, roles and navigation all work with no extra code. The one thing missing for controls that lack a visible text label (for example a bare TreeView used as a category panel) is a human-readable *name*.
setAccessibleName supplies one. Rather than implementing a full IAccessible proxy and intercepting WM_GETOBJECT, it uses MSAA Direct Annotation (IAccPropServices::SetHwndPropStr) to override just the name property on the control's default accessible object. oleacc then serves that name through the standard accessibility path automatically. This is the same mechanism WinForms uses to implement Control.AccessibleName.
COM must be initialized on the calling (UI) thread first — Application.initialize does this.