C#:如何检测屏幕阅读器是否正在运行?
如何检测屏幕阅读器是否正在运行(JAWS)?
据我了解,在 .NET 4 中,我们可以使用 System.Windows.Automation.Provider 命名空间中的 AutomationInteropProvider.ClientsAreListening ,但是如果我必须在 .NET 2.0 中这样做怎么办?
我尝试检查 ClientsAreListening
源代码,它从 UIAutomationCore.dll 库调用外部 RawUiaClientsAreListening
方法。
您对如何在 .NET 2.0 中实现 JAWS 检测有什么想法吗?
How to detect if screen reader is running (JAWS)?
As I understand in .NET 4 we can use AutomationInteropProvider.ClientsAreListening
from System.Windows.Automation.Provider
namespace, but what if I have to do it for .NET 2.0?
I tried to inspect ClientsAreListening
source code, it calls external RawUiaClientsAreListening
method from UIAutomationCore.dll library.
Do you have any ideas how to implement JAWS detection in .NET 2.0?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
SystemParametersInfo
函数< /a> 传递SPI_GETSCREENREADER
的uiAction
。您需要为此使用 P/Invoke ,例如:
这可能更好比使用
ClientsAreListening
属性,因为此属性似乎对任何自动化客户端(而不仅仅是屏幕阅读器)返回 true。另请参阅:
您还应该侦听
WM_SETTINGCHANGE
消息以检测屏幕阅读器是否启动/停止跑步。更新(回应 BrendanMcK 的评论):
虽然从未用如此多的文字明确记录这一点,但查看该标志的描述我认为该标志的目的相对明确:
这意味着,每当应用程序希望 UI 表现得像屏幕阅读器正在运行时,应用程序就会设置此标志,无论该应用程序是否实际上是屏幕阅读器。
响应此标志的合适操作是 添加文本以便向用户“读取”直观的 UI 状态。如果需要彻底更改来使您的 UI 屏幕阅读器易于访问,那么您的 UI 对于签名用户来说也可能不是那么直观,可能需要重新考虑。
Use the
SystemParametersInfo
function passing auiAction
ofSPI_GETSCREENREADER
.You will need to use P/Invoke for this, for example:
This is possibly better than using the
ClientsAreListening
property as this property appears to return true for any automation client, not just screen readers.Also see:
You should also listen for the
WM_SETTINGCHANGE
message to detect if a screen reader starts / stops running.Update (in response to BrendanMcK's comments):
Although this is never explicitly documented in as many words, looking at the description of the flag I think the purpose of this flag is relatively clear:
What this is saying is that applications set this flag whenever an application wishes the UI to behave as if a screen reader is running, regardless of whether or not that application is actually a screen reader or not.
Suitable things to do in response to this flag is to add text in order to "read" otherwise intuitive UI state to the user. If radical changes are needed to make your UI screen reader accessible then the chances are that your UI also isn't that intuitive to sigted users and could probably do with a re-think.