| |

VerySource

 Forgot password?
 Register
Search
View: 812|Reply: 1

I ’m using a six-button mouse. Excuse me, heroes, how can I intercept the message sent by the fourth mouse button?

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-29 21:30:01
| Show all posts |Read mode
I ’m using a six-button mouse (that is, a gaming mouse). Excuse me, how do you intercept the message sent by the fourth mouse button?

// I wrote the code like this, but the value of Button is only the left and right mouse buttons and the middle wheel button, which cannot control the fourth mouse button.
procedure TForm1.FormMouseDown (Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Button = mbLeft then // left mouse button
    ShowMessage ('Left')
  else if Button = mbRight then //
    ShowMessage ('Right')
  else // mouse wheel
    ShowMessage ('Middle');
end;

How can I write code to control the fourth button of the mouse? I want to show a message after pressing the fourth mouse button.
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-7-24 11:00:02
| Show all posts
I used SPY++ to find that when the fourth button of the mouse was clicked, the message sent was 0x020B, so I overloaded the window function to intercept this message.
procedure TForm1.WndProc(var Msg: TMessage);
begin
  if Msg.Msg = 523 then
    ShowMessage('Catch the mouse fifth key message!');
  inherited;
end;

If a single Form is used, this message can be intercepted. But when I put a Panel on this Form (the property is set to Client), I can't intercept this message. I want to ask you heroes, is the window function only for Form? If I have put a lot of controls on this Form, how should I intercept this message, thank you!
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