Send mouse & keyboard events

前端 未结 2 466
不知归路
不知归路 2020-12-09 21:45

I\'m developing an app that have to send some keys or mouse events to the active window.

I\'m using this class: Mouse

using System.R         


        
相关标签:
2条回答
  • 2020-12-09 22:06

    There is an open source project on CodePlex (Microsoft's open source website)

    Windows Input Simulator (C# SendInput Wrapper - Simulate Keyboard and Mouse)

    http://inputsimulator.codeplex.com/

    It has examples and real simple to use.

    0 讨论(0)
  • 2020-12-09 22:26

    Your definitions should be Uint32:

    private const UInt32 MOUSEEVENTF_LEFTDOWN = 0x02;
    private const UInt32 MOUSEEVENTF_ABSOLUTE = 0x8000;
    private const UInt32 MOUSEEVENTF_LEFTUP = 0x04;
    private const UInt32 MOUSEEVENTF_RIGHTDOWN = 0x08;
    private const UInt32 MOUSEEVENTF_RIGHTUP = 0x10;
    
    0 讨论(0)
提交回复
热议问题