How do I use Rundll32 to swapmousebutton?

前端 未结 5 774
没有蜡笔的小新
没有蜡笔的小新 2021-02-06 10:55

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

From MSDN\'s SwapMouseButton Function.

How do I pass boolean data from

5条回答
  •  既然无缘
    2021-02-06 11:15

    There is hack, which can be used to configure the layout of the mouse for a left-handed user. Just run the following command:

    rundll32.exe user32.dll,SwapMouseButton
    

    Run this command to reconfigure the layout of the mouse for a left-handed user.

    I am going to give you an explanation for this kind of behaviour:

    Functions, which are called by rundll32.exe, have the following function prototype:

    void CALLBACK  EntryPoint(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);
    

    SwapMouseButton has the following function prototype:

    BOOL WINAPI SwapMouseButton(
      _In_ BOOL fSwap
    )
    

    SwapMouseButton uses the same calling convention (__stdcall) as every function called by rundll32.exe does.

    If you call SwapMouseButton using rundll32.exe with an additional command-line, this command-line will be passed to this function as lpszCmdLine and will be ignored.

    If you call that functions using rundll32, rundll32 automatically passes a valid window handle (HWND) as the first argument of the called function.

    hwnd - window handle that should be used as the owner window for any windows your DLL creates

    The function SwapMouseButton function called by rundll32 requires TRUE as the first argument in order to configure the layout of the mouse for a left-handed user. The valid window handle passed by rundll32.exe to SwapMouseButton within user32.dll is unequal to 0 and is defined as TRUE, when using a BOOL value.

    You can find details on rundll32.exe and the prototype used by functions called by this executable here: INFO: Windows Rundll and Rundll32 Interface

    You can find details about the function SwapMouseButton here: SwapMouseButton function (Windows)

提交回复
热议问题