|
-
Jul 28th, 2007, 08:02 PM
#1
Thread Starter
Lively Member
Kill the mouse wheel
I have a form with Autoscroll = true
When I scroll the mouse wheel and the focus is on a button or textbox, it is OK
But when the focus is on a control like combobox or a listview (any control having its own scrollbar) no scrolling at the form level occur
I want to kill the mouse wheel message sent to the combobox and send it back to the form.
In VB6 I ve done it using subclassing. Should I do the same (I think using System.Windows.Forms.Form.WndProc) or is there a better way.
and if this is the case, is there something like an Enum listing messages?
-
Jul 28th, 2007, 08:35 PM
#2
Re: Kill the mouse wheel
Sure you can cancel out the message WM_MOUSEWHEEL when the combo box is focused.
Yes, you do use the WndProc overrides
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 28th, 2007, 09:31 PM
#3
Thread Starter
Lively Member
Re: Kill the mouse wheel
OK, where can I find the values for such messages?
-
Jul 28th, 2007, 09:45 PM
#4
Re: Kill the mouse wheel
In the WndProc overrides procedure like in post #2.
Just define your constant and place the code behind the form in question
Code:
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Select Case m.Msg
Case WM_MOUSEWHEEL
'Do your stuff here or cancel it by exiting the sub
Case Else
'
End Select
MyBase.WndProc(m)
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 28th, 2007, 10:32 PM
#5
Re: Kill the mouse wheel
Rub I don't think it will work. I think the message is already in the message queue when WndProc gets the message. I guess it should be handled low-level.
Another option would be using mouse hook. Check Global Hooks in my signature. Use it to hook the mouse and use this code below.
vb Code:
Private Sub gmh_MouseWheel(ByVal sender As System.IntPtr, ByVal e As WindowsHookLib.LLMouseEventArgs) Handles gmh.MouseWheel
If Me.ComboBox1.Focused Then
e.Handled = True
End If
End Sub
-
Jul 29th, 2007, 12:11 AM
#6
Thread Starter
Lively Member
Re: Kill the mouse wheel
In post #3 I asked about the value of the WM_MOUSEWHEEL constant, where can I find these values e.g.
Code:
Public Const WM_MOUSEWHEEL As Integer = ??
Is there a place of such values?
Last edited by Amr Al-Amir; Jul 29th, 2007 at 06:07 PM.
-
Jul 29th, 2007, 01:17 AM
#7
Re: Kill the mouse wheel
You can get API utilities like the API Viewer utility (link in my signature) or also at pinvoke.net for another.
Code:
Private Const WM_MOUSEWHEEL As Int32 = &H20A
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|