using dll files and converting from C# to C
I have found the following article which is basically trying to do what I want, but I need it in C instead of C# and I have absolutely no experience in C#. Also how do I use the Dll import files, i am not really sure how to handle this. Thanks!
Ok, first I'll describe how the program works:
It moves the mouse to the top-left corner of the screen (0,0) and clicks the mouse (causing any other program to lose focus).
The following API moves the mouse:
public static extern int SetCursorPos(int x, int y);
This is fairly easy to understand, it gets the coordinates and moves the mouse to that position, but how do I click then?
public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
Ok then, there's an API called mouse_event. you're probably wondering how it's used, so here's an example:
First, you make an enumeration (you might as well use the integers themselves, i just find this way to be more organized.
mouse_event((int)MouseEventType.LeftDown, Cursor.Position.X, Cursor.Position.Y, 0, 0);
mouse_event((int)MouseEventType.LeftUp, Cursor.Position.X, Cursor.Position.Y, 0, 0);<code>
Woohoo! we got ourselves a Mouseclick!
The full code:
Re: using dll files and converting from C# to C
Do you mean C under windows or Linux.
|All times are GMT +5.5. The time now is 09:46.|