Click here to Skip to main content
15,886,074 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So I am working on an application similar to macro recorder, where I am recording the mouse movement and the keyboard. In the application (C#), I can record the mouse movement and replay it. But am stuck at the point where after saving the position of the mouse I can load the position (and I have loaded as a text in a listBox) and now I need to make the mouse read these position (in the listBox) and move. I don't have a code to show you because am stuck at this part
Could anyone help me out?

What I have tried:

I dont have code to show but this what i have in my [play] button

private void button2_Click(object sender, EventArgs e)
{

manager.ExecuteActions();
}
Posted
Updated 25-Apr-18 17:49pm

1 solution

If I understand your question correctly and taken that this is Windows Forms, you can track mouse movement with Control.MouseMove Event (System.Windows.Forms)[^] and get or set the position with Cursor.Position Property (System.Windows.Forms)[^]
 
Share this answer
 
Comments
Member 13798739 26-Apr-18 0:21am    
@Wendelius, I have the mouse position shown in a list, right, and then I save it in a file. Then I will open the file again, and then when I press on [play] button, I want the mouse read the file that I have just open (which contain positions ) and move according to it
Wendelius 26-Apr-18 11:57am    
When the button is clicked, do the following, read each line and with each line set the cursor position to the location in your app where it was recorded. Use a small delay between the set operations in order to see the results on the screen.

Also note that if the location of your window has changed you must take that into account so you might want to store the original window location.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900