Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8112485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:31:01+00:00 2026-06-06T02:31:01+00:00

I’m designing a form with a horizontal scroll bar docked at the bottom. I

  • 0

I’m designing a form with a horizontal scroll bar docked at the bottom. I wanted to add support for side-scrolling using mouse tilt buttons and found this solution which, after a bit of tinkering, seemed to do the trick – that is, while the form only had GDI graphics drawn on its surface.

However, since then I’ve added some controls to the form and found that when the mouse is over any of them the tilt operation only fires once-at-a-time instead of repeatedly as it does when the mouse is over any other part of the form.

To see what I mean (if you have a mouse with tilt buttons) dock a horizontal scrollbar onto the bottom of a form, add a few other controls and paste in this code:

Public Class Form1
    Const WM_MOUSEHWHEEL As Integer = &H20E

    Protected Overrides Sub WndProc(ByRef m As Message)
        MyBase.WndProc(m)
        If Me.IsDisposed OrElse m.HWnd <> Me.Handle Then Return 
        Select Case m.Msg
            Case WM_MOUSEHWHEEL
                With HScrollBar1
                    If CType(m.WParam, Integer) < 0 Then '______________ Left Scroll
                        If .Value > 0 Then .Value -= 1
                    Else '______________________________________________ Right Scroll
                        If .Value < (.Maximum - .LargeChange + 1) Then .Value += 1
                    End If
                End With
                m.Result = CType(1, IntPtr) 'Indicates the message has been handled
        End Select
    End Sub

    Private Sub HScrollBar1_ValueChanged(sender As Object, e As System.EventArgs) Handles HScrollBar1.ValueChanged
        Console.WriteLine(HScrollBar1.Value)
    End Sub
End Class

You’ll see that side-scrolling repeats when the mouse is over a blank part of the form, but only “one-shots” when it’s over a control.

I’m guessing the solution lies somewhere in the message’s .Result value, but I’m at a loss as to what that should be. In fact I’m not even sure I’m returning a correct value anyway because the code in the original solution threw an exception to the DirectCast function so I swapped that for CType, which seemed to work okay. I’ve tried working it out using Spy++ but I can’t see anything obvious.

Any ideas please?


UPDATE

I’ve noticed when I include ‘Child’ windows in Spy++ there are two (0x020E) messages and two return values, 1 then 0. I presume the message is being passed onto the control by the form. So I guess the question now is: can the message be prevented from being passed to the control? Or can the control’s return value be intercepted and converted to 1?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:31:03+00:00Added an answer on June 6, 2026 at 2:31 am

    I’ve managed to contrive a workaround but I feel sure there must be a better method than this. What I’ve done is add a class for each type of control used on my form and inheriting from the control. Then I’ve added a WndProc procedure to each class so that 1 is always returned for WM_MOUSEHWHEEL messages processed by these controls. For example, this is the button class:

    Public Class scButton
        Inherits Button
        Protected Overrides Sub WndProc(ByRef m As Message)
            MyBase.WndProc(m)
            If Me.IsDisposed OrElse m.HWnd <> Me.Handle Then Return
            If m.Msg = Win32Messages.WM_MOUSEHWHEEL Then m.Result = New IntPtr(1)
        End Sub
    End Class
    

    Then it was just a matter of changing the references in the form’s designer code.

    As I say, I’m sure there must be a better method than this. It would be painful if you had to do it for a large number of different control classes, but in my case I just needed it for a few basic controls.


    I left this open for a few days in the hope that someone would suggest a better solution but nothing has been forthcoming so I’m going to accept my own answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.