Windows runtime 在Windows运行时检测鼠标

Windows runtime 在Windows运行时检测鼠标,windows-runtime,touch,mouse,Windows Runtime,Touch,Mouse,我想指示我的应用程序的用户“点击”或“点击”,这取决于他们是否有鼠标或触摸屏 基本上我想这样做: if(Controls.hasMouse()) ShowMessage("Click here to continue"); else ShowMessage("Tap here to continue"); 如何检测鼠标是否连接到系统?我找到了解决问题的方法: using namespace Windows::Devices::Input; MouseCapabilities^ m

我想指示我的应用程序的用户“点击”或“点击”,这取决于他们是否有鼠标或触摸屏

基本上我想这样做:

if(Controls.hasMouse())
   ShowMessage("Click here to continue");
else
   ShowMessage("Tap here to continue");

如何检测鼠标是否连接到系统?

我找到了解决问题的方法:

using namespace Windows::Devices::Input;

MouseCapabilities^ mcap = ref new MouseCapabilities();
bool has_mouse = mcap->MousePresent == 1;

您是否考虑过检查触摸功能是否也存在?如果屏幕没有触摸功能,您不会要求用户触摸屏幕,对吗?有效点。在我们的例子中,期望用户拥有这两者中的任何一个都是合理的,但将来可能需要区分笔(用户用笔“点击”了吗?或者有更合适的术语吗?),类似Kinect的身体姿势和语音命令。请注意,Windows RT是Windows的SKU。您可能指的是Windows运行时,通常缩写为WinRT。