How to capture WHEEL_DELTA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Traps
    New Member
    • Apr 2007
    • 9

    How to capture WHEEL_DELTA

    I cant seem to figure out how to determine if the mouse wheel is scrolled up or down after the WM_MOUSEWHEEL event has occured. Microsoft states the wParam value will contain the WHEEL_DELTA value in the high-order word. How do I get the wParam value? Please help me, I have threads going in 4 vb coding forums including microsoft's msdn, and I cant seem to find an answer.


    http://msdn.microsoft. com/library/default.asp?url =/library/en-us/winui/winui/windowsuserinte rface/userinput/mouseinput/mouseinputrefer ence/mouseinputmessa ges/wm_mousewheel.a sp

    ****I am using JournalRecordPr oc

    Public Function JournalRecordPr oc(ByVal Code As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

    **** and doing this

    CopyMemory tEVENTMSG, ByVal lParam, Len(tEVENTMSG)

    **** where tEVENTMSG is structed as follows

    Public Type EVENTMSG
    message As Long
    paramL As Long
    paramH As Long
    time As Long
    hwnd As Long
    End Type


    paramL and paramH do not contain the DWORD value to retrieve WHEEL_DELTA
  • Traps
    New Member
    • Apr 2007
    • 9

    #2
    Bumping.....Ple ase help.........

    Comment

    • Traps
      New Member
      • Apr 2007
      • 9

      #3
      Figured it out on my own. Thanks anyway.

      If anyone is interested in the answer comment in this thread and I'll tell you. Otherwise.....y our on your own.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by Traps
        Figured it out on my own. Thanks anyway.

        If anyone is interested in the answer comment in this thread and I'll tell you. Otherwise.....y our on your own.
        Hi.

        Sorry you weren't able to source your answer here. Ordinarily I'd have expected to see a better response, but of course there are no guarantees in life.

        I for one would certainly be interested to see the answer, and would also like to have it available here for anyone who faces a similar problem in the future.

        Comment

        • Traps
          New Member
          • Apr 2007
          • 9

          #5
          I had a single form named form1

          I subclassed the form with this hook..........
          Code:
          lngOldProc = SetWindowLong(form1.hwnd, GWL_WNDPROC, AddressOf WindowProc)
          and this procedure...... .......

          Code:
          Public Function WindowProc(ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
              Select Case msg
                  Case WM_MOUSEWHEEL
                      WheelDelta = HiWord(wParam)
                  Case Else
                      WindowProc = CallWindowProc(lngOldProc, hwnd, msg, wParam, lParam)
              End Select
          
          End Function
          with this function ...............
          Code:
          Public Function HiWord(ByVal DWord As Long) As Integer
              HiWord = (DWord And &HFFFF0000) \ &H10000
          End Function

          And this worked fine for the form1.hwnd I declared in the hook. However when changing the hwnd value to the value I capture from eventmsg structure in JournalRecordPr oc to an active window created from a different process the hook doesnt work..........

          According to microsoft in re: SetWindowLong

          An application can subclass a system class, but should not subclass a window class created by another process.
          So this kinda leaves me back at square one. Brings to mind a question about windows programming. What is the difference between a subclass, and a window class? Is a subclass like a control on the active window? Should I be using the hwnd of a control from the window created under a different process rather than the hwnd of the window itself?
          Last edited by Killer42; Apr 4 '07, 03:40 AM. Reason: Added [CODE]...[/CODE] tags

          Comment

          • Traps
            New Member
            • Apr 2007
            • 9

            #6
            I didnt want to do this but it looks like I gotta...

            WH_MOUSE_LL hook will provide the MSLLHOOKSTRUCT where I can extract the DELTA value from any window system wide. Better than trying to subclass, which you can not do on windows under a different process.

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Originally posted by Traps
              I didnt want to do this but it looks like I gotta...

              WH_MOUSE_LL hook will provide the MSLLHOOKSTRUCT where I can extract the DELTA value from any window system wide. Better than trying to subclass, which you can not do on windows under a different process.
              Don't know about the others here, but this is mostly over my head. Perhaps you'd have been better off hitting somewhere like the Windows forum for this sort of thing. Or one of the languages that doesn't tend to insulate the developer quite so much from the OS.

              I know you can do just about anything in VB, but in my experience the majority of programmers tend not to. Sadly.

              Anyway, thanks for the info.

              Comment

              Working...