| |

VerySource

 Forgot password?
 Register
Search
View: 1015|Reply: 8

A mouse message problem

[Copy link]

3

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-5 15:30:01
| Show all posts |Read mode
I want to use the right-click message to trigger a ListBox menu, and then select an item of the menu,
:: PostMessage (pListBoxWnd, WM_RBUTTONDOWN, 0, 0);
:: PostMessage (pListBoxWnd, WM_RBUTTONUP, 0, 0);
Can trigger the menu of ListBox, but I want to move the mouse over an item and click to realize the selection of the menu. So I add mouse_event (MOUSEEVENTF_MOVE, 10,0,0,0); I find that the order is wrong, the mouse does not trigger the right button first, Move again, but move first and then trigger the right-click menu. What's going on? How can the order be wrong? How to overcome this problem
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-6 09:30:01
| Show all posts
Passing by
If you remember correctly, there are mouse coordinates in lParam, try changing it
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-6 16:42:01
| Show all posts
use SendMessage
Reply

Use magic Report

0

Threads

24

Posts

19.00

Credits

Newbie

Rank: 1

Credits
19.00

 China

Post time: 2020-1-7 19:18:01
| Show all posts
Both use mouse_event or SendInput.
Reply

Use magic Report

0

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-9 09:54:01
| Show all posts
Using PostMessage just puts the message in the message queue, and the message is not immediately responded.
You can go to the third floor and use SendMessage instead of PostMessage
Can also be used as mentioned on the 4th floor
Mouse_event (MOUSEEVENTF_RIGHTDOWN, 0,0,0,0); // simulate pressing the right mouse button.
Mouse_event (MOUSEEVENTF_RIGHTUP, 0,0,0,0); // Simulate and release the right mouse button.
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-9 13:18:01
| Show all posts
Can ListBox use SetCurSel directly to set the currently selected item?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-26 23:45:01
| Show all posts
Change PostMessage to SendMessage
Reply

Use magic Report

0

Threads

14

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-7-27 09:15:01
| Show all posts
ls makes sense, it is recommended to try
Reply

Use magic Report

1

Threads

15

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-7-28 19:15:01
| Show all posts
Try the one on the first floor

PostMessage does not return, SendMessage will not continue until it returns, so let the previous one execute and then execute the next mouse event
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