| |

VerySource

 Forgot password?
 Register
Search
View: 3498|Reply: 24

Ask how to record and play back mouse events (I have just come into contact with vc students for two weeks)

[Copy link]

1

Threads

14

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-1-13 15:00:01
| Show all posts |Read mode
Thank you
It's best to talk briefly about how specific functions are used. The slightly more complex msdn I don't understand at the moment. . . . . .
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-17 08:09:02
| Show all posts
The simplest is to use SetTimer to record the position of the mouse and save it in a text file.
Get location using GetCursorPos,
Reverse operation during playback, use SetCursorPos to specify the mouse to the specified position
Reply

Use magic Report

1

Threads

14

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

 Author| Post time: 2020-1-17 17:09:01
| Show all posts
Thank you, but I have already done this step. My main question is to click the left and right buttons for recording and playback. Thank you so much.
Reply

Use magic Report

1

Threads

14

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

 Author| Post time: 2020-1-19 19:00:02
| Show all posts
Only up
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 United States

Post time: 2020-1-20 18:09:01
| Show all posts
Very simple,
Set up a structure,
5 variables,
The first two are the position information of the mouse, and the last three are the states of the three mouse buttons.
5 volumes to record together,
Play back together!


Think about it, there will be a way!
Reply

Use magic Report

1

Threads

14

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

 Author| Post time: 2020-1-20 23:45:01
| Show all posts
Thank you for your attention, however. . . I don't know what function to use to record the status of the 3 keys. . . . Distressed for a day. . . . (I don't know what function to play back)
    Hope pointing
Thanks in advance (new novices released today help me more)
Reply

Use magic Report

1

Threads

14

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

 Author| Post time: 2020-1-21 07:36:01
| Show all posts
By the way, you mentioned at the beginning
GetCursorPos and SetCursorPos
Can only record and play the mouse position. . . . . .
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-21 15:09:02
| Show all posts
If you use Directx to get the mouse status, it may be too deep.
So you can think of not using DirectX, but using existing functions to combine implementations.
int x, y, lm, mm, rm; // position X, position Y, left button state, middle button state, right button state
Keep saving these 5 values ​​during the timer

In PreTranslateMessage:
if (pMsg-> message == WM_LBUTTONDOWN)
 lm = 1;
if (pMsg-> message == WM_LBUTTONUP)
 lm = 0;

And so on, changed to the state of the other two keys of the mouse.

During playback, use key_event to simulate the operation
Reply

Use magic Report

1

Threads

14

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

 Author| Post time: 2020-1-21 22:09:01
| Show all posts
Thanks again, I will try again, hope you continue to follow, thank you
Reply

Use magic Report

1

Threads

14

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

 Author| Post time: 2020-1-26 17:54:01
| Show all posts
msdn did not find key_event, implemented mouse playback with mouse_event

one more question, of the keyboard. . . . . How to deal with it?
1.message == ?? (keyboard related)
2.key_event is not used to simulate the keyboard? ?

Good life is safe
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list