如何检测 Windows 10 是否处于平板电脑模式

How to detect if Windows 10 is in tablet mode

我正在尝试找到一种方法来检测 Windows 10 是否处于平板电脑模式。请注意,这不是查询用户是否有平板电脑 - 可以用 GetSystemMetrics(SM_CONVERTIBLESLATEMODE) 解决。在我的例子中,上面的函数总是 returns 0 - 无论 Win10 是否处于平板电脑模式。

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 这意味着如果 Windows 10 处于平板电脑模式,我需要以不同方式解决应用程序的启动问题。

我可以将在收到 WM_SHOWWINDOW 消息后当前触发的代码移动到其他地方(就在调用 ShowWindow 之后),但随后我收到一条 WM_DPICHANGED 消息空参数。

你可以使用 UIViewSettings.UserInteractionMode @Raymond 指出。

参考“Tablet mode" "How can I detect whether my PC is in tablet mode?