如何检测 Windows 10 是否处于平板电脑模式 [英] How to detect if Windows 10 is in tablet mode
问题描述
我正在尝试寻找一种方法来检测 Windows 10 是否处于平板电脑模式.请注意,这不是关于查询用户是否拥有平板电脑 - 这可以通过 GetSystemMetrics(SM_CONVERTIBLESLATEMODE)
解决.就我而言,上述函数始终返回 0 - 无论 Win10 是否处于平板电脑模式.
这个没有结尾的线程似乎表明没有 WinAPI 调用可以检测平板电脑模式.我希望不是这样,因为无论是否处于平板电脑模式,操作系统都会发布不同的 WM 消息.在平板电脑模式下 WM_SHOWWINDOW is not sent 这意味着我需要解决如果 Windows 10 处于平板电脑模式,则应用程序会有所不同.
我可以将接收到 WM_SHOWWINDOW
消息后当前触发的代码移动到其他地方(就在 ShowWindow
被调用之后),但随后我得到了一个 WM_DPICHANGED
带有空参数的消息.
你可以使用 UIViewSettings.UserInteractionMode @Raymond 指出.
请参阅平板电脑模式" "如何检测我的电脑是否处于平板电脑模式?">
I'm trying to find a method to detect if Windows 10 is in tablet mode or not. Please note, this is not about querying whether the user has a Tablet PC or not - that can be solved with GetSystemMetrics(SM_CONVERTIBLESLATEMODE)
. In my case the above function always returns 0 - whether Win10 is in tablet mode or not.
This thread without an epilogue seems to suggest that there is no WinAPI call that could detect Tablet mode. I hope that isn't the case, since there are different WM messages posted by the OS if it's in tablet mode or not. In tablet mode WM_SHOWWINDOW isn't sent which means I need to address the launching of the application differently if Windows 10 is in tablet mode.
I could just move the code that is currently triggered after receiving the WM_SHOWWINDOW
message somewhere else (just after ShowWindow
is called), but then I get a WM_DPICHANGED
message with null parameters.
You can use UIViewSettings.UserInteractionMode @Raymond pointed out.
Refer to "Tablet mode" "How can I detect whether my PC is in tablet mode?"
这篇关于如何检测 Windows 10 是否处于平板电脑模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!