SystemMouse Moves And Clicks In Your System

SystemMouse is a class I managed to create for Remotair demo receiver, in order to show how can remote MouseEvent-s be projected into system. Long story short, you can use moveBy() function to move the system cursor and event() function to make clicks. The class is based on NativeProcess. The NativeProcess class and its capabilities are only available to AIR applications installed with a native installer (extended desktop profile applications) means .exe/.dmg file.

This was also my first touch with C++ (Microsoft Visual C++ 2010 Express). Soon I realized, microsoft does good job with its msdn documentation for functions I needed: mouse_event and SetCursorPos. Based on the docs I have created MouseEvent.exe and MoveCursor.exe (source code in comments SystemMouse). Those can be easily tested from a command line. To make right click just call:

MouseEvent.exe RIGHTCLICK

To move cursor 10px right and 20px down from actual position run:

MoveCursor.exe 10 20

With SystemMouse you can do it by calling:

SystemMouse.event("MouseEvent.exe", SystemMouse.MOUSE_RIGHT_CLICK)
SystemMouse.moveBy("MoveCursor.exe", 10, 20)

Do not forget to compile .exe files into your air project and create native installes .exe/.dmg file with correct manifest settings:


1 comment so far

  1. Slavomir Durej December 22, 2010 11:48

    Awesome work!

Leave a comment

Please be polite and on topic. Your e-mail will never be published.