如何使用Rundll32来交换mousebutton? [英] How do I use Rundll32 to swapmousebutton?

查看:131
本文介绍了如何使用Rundll32来交换mousebutton?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要从另一个论坛重复一个问题,因为我想要相同的答案.

I'm repeating a question from another forum, as I'd like the same answer.

来自MSDN的 SwapMouseButton函数.

如何将命令提示符中的布尔数据通过rundll32.exe传递给从user32.dll运行的命令中的布尔类型参数?

How do I pass boolean data from command prompt through rundll32.exe to a boolean type argument in a command running from user32.dll?

我正在尝试从CMD(命令提示符)运行它

I'm trying to run this from CMD (the command prompt)

RUNDLL32.EXE user32.dll,SwapMouseButton *

这里的星号是参数应该去的地方.我已经在没有参数的情况下运行了它,并且它交换了我的鼠标左键和右键(似乎TRUE是布尔参数的默认条目).现在我要撤消它. 但是,我已经尝试过在参数中传递FALSE的所有方法,但都没有奏效(都没有将我的鼠标按钮设置回正常状态).

Where the asterisk is here is where the argument should go. I already ran it without an argument and it swapped my left and right mouse buttons (seems TRUE is the default entry for the boolean argument). Now I want to undo it. However I've tried each of these for passing FALSE in the argument, and none have worked (none set my mouse buttons back to normal).

  • F
  • f
  • false
  • 错误
  • 假"
  • 假"
  • 假"
  • 0
  • -1
  • F
  • f
  • false
  • False
  • FALSE
  • "false"
  • "False"
  • "FALSE"
  • 0
  • -1

请根据需要帮助我传递参数.预先感谢.

Please help me pass the argument as needed. Thanks in advance.

推荐答案

不要 使用 rundll32 .

Q164787:信息:Windows Rundll和Rundll32接口

Q164787: INFO: Windows Rundll and Rundll32 Interface

[...] Rundll和Rundll32程序不允许您从任何DLL调用任何导出的函数.例如,您不能使用这些实用程序来调用从系统DLL导出的Win32 API(应用程序编程接口)调用.这些程序仅允许您从DLL中调用明确编写要由它们调用的函数.

[...] Rundll and Rundll32 programs do not allow you to call any exported function from any DLL. For example, you can not use these utility programs to call the Win32 API (Application Programming Interface) calls exported from the system DLLs. The programs only allow you to call functions from a DLL that are explicitly written to be called by them.


如果安装了.NET Framework Runtime,则它带有针对多种语言的编译器(例如,对于64位系统上的v3.5 C#编译器,为%SystemRoot%\Microsoft.NET\Framework64\v3.5\csc.exe).您可以用C#编写程序:


If you have the .NET Framework Runtime installed, it comes with compilers for several languages (for example, %SystemRoot%\Microsoft.NET\Framework64\v3.5\csc.exe for the v3.5 C# compiler on 64-bit systems). You can write a program in C#:

using System.Runtime.InteropServices;
using System;

class SwapMouse {
    [DllImport("user32.dll")]
    public static extern Int32 SwapMouseButton(Int32 bSwap);
    static void Main(string[] args) {
        if (args.Length > 0 && String.Compare(args[0], "/u", true) == 0)
            SwapMouseButton(0);
        else
            SwapMouseButton(1);
    }
}

编译为:

"%SystemRoot%\Microsoft.NET\Framework64\v3.5\csc" swap.cs

交换/交换按钮:

swap
swap /u

这篇关于如何使用Rundll32来交换mousebutton?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆