How to detect if Windows 10 is in tablet mode

依然范特西╮ 提交于 2019-12-21 05:31:48

问题


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.


回答1:


You can use UIViewSettings.UserInteractionMode @Raymond pointed out.

Refer to "Tablet mode" "How can I detect whether my PC is in tablet mode?"



来源:https://stackoverflow.com/questions/55225753/how-to-detect-if-windows-10-is-in-tablet-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!