Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

program for controlling mouse or keyboard

I'm trying to learn how a program I write can control a GUI program that I'm running. I'm not sure the GUI program will necessarily expose an API for developers. Therefore, I think the best approach will be for my program to be able to exclusively control the keyboard and mouse temporarily or maybe share the control with the user (as long as the user isn't using the resources the program can control mouse/keyboard).

I'm not sure how to do this. I know C/C++, Python and Java. I'm mainly looking to implement this on Windows (I know C#).

I'm not exactly sure what I'm looking for (in terms of keywords) so I don't know how to google for information. Any help would be appreciated.

EDIT: I thought I'd mention that I'm just looking for a method for my code to control mouse and keyboard. The inputs to this code will come from another piece of code which (hopefully) knows what the mouse/keyboard will have to do. Currently I just want to learn how to make my code control mouse/keyboard using a predefined control commands (e.g. move to position (100,100), click, type "abcd" etc.

like image 989
s5s Avatar asked Oct 27 '25 02:10

s5s


1 Answers

SendInput if you want to fake some mouse/keyboard events.

like image 139
BlueWanderer Avatar answered Oct 28 '25 16:10

BlueWanderer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!