I want to create... basically a macro program. After you click record, it keeps track of all mouse (and maybe eventually keyboard) activity. Then you can save it, and play it, and the mouse should move and click in the same spots that it did when you were recording it.
I know how to grab global mouse events, but I don't know how to make mice move/click in C#.
you can use the win32 APIs for this
SetCursorPos
and mouse_event
will alow you to move/click the mouse. look into SendMessage
too for keyboard stuff, but its more complex.
[DllImport("user32.dll")]
static extern bool SetCursorPos(int X, int Y);
static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData,
UIntPtr dwExtraInfo);
If you just need a tool that already does this you could probably use AutoItRecorder. It will record AutoIt scripts that you can run.
I want to create... basically a macro program. After you click record, it keeps track of all mouse (and maybe eventually keyboard) activity. Then you can save it, and play it, and the mouse should move and click in the same spots that it did when you were recording it.
I know how to grab global mouse events, but I don't know how to make mice move/click in C#.
you can use the win32 APIs for this
SetCursorPos
and mouse_event
will alow you to move/click the mouse. look into SendMessage
too for keyboard stuff, but its more complex.
[DllImport("user32.dll")]
static extern bool SetCursorPos(int X, int Y);
static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData,
UIntPtr dwExtraInfo);
If you just need a tool that already does this you could probably use AutoItRecorder. It will record AutoIt scripts that you can run.
0 commentaires:
Enregistrer un commentaire