- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
在 Windows 8 上,我正在尝试使用 C# 确定鼠标的惯用手习惯。换句话说,我正在尝试读取此设置:
Control Panel\Hardware and Sound\Mouse -> Switch primary and secondary buttons.
我试过使用 WMI,但没有成功。无论我使用什么鼠标,惯用手属性值始终为 null。
SelectQuery selectQuery = new SelectQuery("Win32_PointingDevice");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(selectQuery);
foreach (var mouse in searcher.Get())
{
foreach (var property in mouse.Properties)
{
Console.WriteLine("{0}: {1}", property.Name, property.Value);
}
}
还有其他方法可以完成这个任务吗?
最佳答案
我发现在 user32.dll 上公开的 GetSystemMetrics 可用于返回您寻找的交换鼠标按钮数据。这里有一些引用资料和一个用于测试的快速控制台应用程序。第三个链接包含更多关于如何将 GetSystemMetrics 与 C# 结合使用的“官方”示例。
Wrong way to detect swapped mouse
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace ConsoleApplication2
{
class Program
{
[DllImport("user32.dll")]
public static extern Int32 GetSystemMetrics(Int32 bSwap);
static void Main(string[] args)
{
//normally you would make this as a constant:
int SM_SWAPBUTTON = 23;
int isLeftHanded = GetSystemMetrics(SM_SWAPBUTTON);
//0 means not swapped, 1 means swapped (left handedness?)
}
}
}
关于c# - 使用 C# 从 Windows 8 读取惯用手设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34997186/
我对 Clojure 和函数式编程有了大约一周的了解——我的所有背景都是 OOP。我想利用 Clojure 备受争议的易读性和固有逻辑,但现在我不知道我是否成功地做到了这一点,只是没有完全理解它,或者
场景: val col: IndexedSeq[Array[Char]] = for (i = 0 && arr(last.y)(west) == '.') { arr(last.y)(w
我正面临 AngularJS、服务和范围的“问题”。 这不是一个真正的问题(我找到了几种使其工作的方法),但我想知道我是否在做正确的事情,或者我正在做的事情是否会导致将来出现问题 我有一个保存一些全局
进行以下数据结构转换的“Rubyist”方法是什么: 我有 incoming = [ {:date => 20090501, :width => 2}, {:
如何在 go 中编写返回集合最小值的函数?我不只是在寻找解决方案(我知道我可以在遍历第一个元素时只初始化最小值,然后设置一个我初始化最小值的 bool 变量),而是一个惯用的解决方案。由于 go 没有
好的,我知道我应该对我的特定应用程序进行基准测试,等等,但是: -Xmx 的默认 JVM 设置、默认垃圾收集器等,对于大多数典型的 Java 程序来说是合理的默认设置,并且可能不适合惯用的 Scala
既然 shared_ptr 在 tr1 中,你认为 std::auto_ptr 的使用会发生什么?它们都有不同的用例,但 auto_ptr 的所有用例也都可以用 shared_ptr 解决。你会放弃
这个问题在这里已经有了答案: What are the differences between type() and isinstance()? (8 个回答) 关闭 9 年前。 我需要知道 Pyth
在指定和创建数字函数时,是否有关于何时返回 null 以及何时返回 NaN 的任何 C# 惯用准则,当两者似乎都是有效输出时。 导致这个问题的具体例子是我正在为 Enumerable 集合创建一个百分
这个问题在这里已经有了答案: Retrieving the top 100 numbers from one hundred million of numbers [duplicate] (12 个
我可以通过反射检索方法,以某种方式将其与目标对象结合起来,并将其作为看起来像 Scala 中的函数的东西返回(即您可以使用括号调用它)吗?参数列表是可变的。它不一定是“一流”函数(我已经更新了问题),
我是一名优秀的程序员,十分优秀!