开发者

Looking for a good example of Linux mouse programming in C

开发者 https://www.devze.com 2023-01-27 00:00 出处:网络
I am trying to get my feet wet in C, and I am curious to know how you can control the mouse pointer, and simulate a click, etc. To help myself learn, this would be a simple example where the keyboard

I am trying to get my feet wet in C, and I am curious to know how you can control the mouse pointer, and simulate a click, etc. To help myself learn, this would be a simple example where the keyboard arrows & spacebar would simulate these effects. I started here:

http://www.cprogrammingreference.com/Tutorials/Advance_Tutorials/mouseprogramming开发者_开发技巧.php

But since I am in a linux environment, these obviously fail compiling.

#include <dos.h>
#include <graphics.h>

Is there a better example for me to start with in linux? Is it as simple as including different header files and using the same code, or are the routines completely different for linux (as one would expect)?

UPDATE Linux only would work great, as I am just learning.


http://snippets.dzone.com/posts/show/2750

That shows a quick snippet on simulating a mouse click. From there you can look into the other functions in the Xlib library.

Also there's a tool that does the same things you're talking about, you might want to take a look at its source if you want to know more about it.

http://www.semicomplete.com/projects/xdotool/

0

精彩评论

暂无评论...
验证码 换一张
取 消