Author: Peter Below
Is there any way to disable the mouse wheel for a particular application or form?
Answer:
You can use a handler for the Application.OnMessage event to filter out messages
(e.g WM_MOUSEWHEEL) before any control in your application sees them. Note that
this will not work with all mouse drivers. There are some that can be configured to
not post the standard wheel messages but to send WM_VSCROLL messages instead if the
control under the mouse has scrollbars. This "compatibility mode" is there to make
the wheel usable with applications that do not have wheel support build in.
1 procedure TMainForm.FormCreate(Sender: TObject);
2 begin3 Application.OnMessage := AppMessage;
4 end;
5 6 procedure TMainform.Appmessage(var Msg: TMsg; var Handled: Boolean);
7 begin8 Handled := msg.message = WM_MOUSEWHEEL;
9 end;
10 11 if you only want todo this for a specific form class you would modify this method
12 to13 14 procedure TMainform.Appmessage(var Msg: TMsg; var Handled: Boolean);
15 begin16 Handled := (msg.message = WM_MOUSEWHEEL) and17 (Screen.Activeform is TMySpecialFormclass);
18 end;