Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to receive SB_THUMBPOSITION

How to receive SB_THUMBPOSITION

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Luke Murray
    wrote on last edited by
    #1

    Hey all, I have a dialog that has a richedit control on it. I receive EN_VSCROLL messages through the WM_COMMAND message in the parent window. I can not figuer out how to catch the SB_THUMBPOSITION message. To catch the EN_VSCROLL messages I had to set the event mask SendMessage(hrichEdit, EM_SETEVENTMASK, 0, LPARAM(SendMessage(hwndDlg, EM_GETEVENTMASK, 0, 0) | ENM_SCROLL )); Any ideas? Cheers, Luke

    P C L 3 Replies Last reply
    0
    • L Luke Murray

      Hey all, I have a dialog that has a richedit control on it. I receive EN_VSCROLL messages through the WM_COMMAND message in the parent window. I can not figuer out how to catch the SB_THUMBPOSITION message. To catch the EN_VSCROLL messages I had to set the event mask SendMessage(hrichEdit, EM_SETEVENTMASK, 0, LPARAM(SendMessage(hwndDlg, EM_GETEVENTMASK, 0, 0) | ENM_SCROLL )); Any ideas? Cheers, Luke

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #2

      Luke Murray wrote:

      SendMessage(hrichEdit, EM_SETEVENTMASK, 0, LPARAM(SendMessage(hwndDlg, EM_GETEVENTMASK, 0, 0) | ENM_SCROLL ));

      is hwndDlg intentional instead of hrichEdit?


      -prakash

      L 1 Reply Last reply
      0
      • P Prakash Nadar

        Luke Murray wrote:

        SendMessage(hrichEdit, EM_SETEVENTMASK, 0, LPARAM(SendMessage(hwndDlg, EM_GETEVENTMASK, 0, 0) | ENM_SCROLL ));

        is hwndDlg intentional instead of hrichEdit?


        -prakash

        L Offline
        L Offline
        Luke Murray
        wrote on last edited by
        #3

        Sorry that is meant to be hrichEdit, like SendMessage(hrichEdit, EM_SETEVENTMASK, NULL, LPARAM(SendMessage(hrichEdit, EM_GETEVENTMASK, 0, 0) | ENM_SCROLL )); From what I have read. if you have a winproc for a window you can catch WM_VSCROLL and LOWORD(lParam) will be SB_THUMBPOSITION. the issue I have it when its a scroll message from a child window (like in this case) first you catch WM_COMMAND then EN_VSCROLL through HIWORD(wParam) and lParam in this case is the handle to the richedit control. So i'm not sure how to get the message for SB_THUMBPOSITION from the child window. I guess I have to have a winproc for the richedit control and handle it through the WM_VSCROLL etc? Then i'm not too sure on how to do that. The dialog is loaded from a resource file as well. Cheers, Luke

        P 1 Reply Last reply
        0
        • L Luke Murray

          Sorry that is meant to be hrichEdit, like SendMessage(hrichEdit, EM_SETEVENTMASK, NULL, LPARAM(SendMessage(hrichEdit, EM_GETEVENTMASK, 0, 0) | ENM_SCROLL )); From what I have read. if you have a winproc for a window you can catch WM_VSCROLL and LOWORD(lParam) will be SB_THUMBPOSITION. the issue I have it when its a scroll message from a child window (like in this case) first you catch WM_COMMAND then EN_VSCROLL through HIWORD(wParam) and lParam in this case is the handle to the richedit control. So i'm not sure how to get the message for SB_THUMBPOSITION from the child window. I guess I have to have a winproc for the richedit control and handle it through the WM_VSCROLL etc? Then i'm not too sure on how to do that. The dialog is loaded from a resource file as well. Cheers, Luke

          P Offline
          P Offline
          Prakash Nadar
          wrote on last edited by
          #4

          humm, you might want to do subclassing.


          -prakash

          L 1 Reply Last reply
          0
          • P Prakash Nadar

            humm, you might want to do subclassing.


            -prakash

            L Offline
            L Offline
            Luke Murray
            wrote on last edited by
            #5

            Yeah, that was something I hoped to avoid. I really would have thought there would be a way.

            1 Reply Last reply
            0
            • L Luke Murray

              Hey all, I have a dialog that has a richedit control on it. I receive EN_VSCROLL messages through the WM_COMMAND message in the parent window. I can not figuer out how to catch the SB_THUMBPOSITION message. To catch the EN_VSCROLL messages I had to set the event mask SendMessage(hrichEdit, EM_SETEVENTMASK, 0, LPARAM(SendMessage(hwndDlg, EM_GETEVENTMASK, 0, 0) | ENM_SCROLL )); Any ideas? Cheers, Luke

              C Offline
              C Offline
              Calc20
              wrote on last edited by
              #6

              You have to catch WM_HSCROLL or WM_VSCROLL messages and in the WPARAM argument you can find SB_THUMBPOSITION or some other code depending on what the user is doing with the scroll bar.

              L 1 Reply Last reply
              0
              • C Calc20

                You have to catch WM_HSCROLL or WM_VSCROLL messages and in the WPARAM argument you can find SB_THUMBPOSITION or some other code depending on what the user is doing with the scroll bar.

                L Offline
                L Offline
                Luke Murray
                wrote on last edited by
                #7

                The problem is WM_VSCROLL etc get sent to the richedit control, not my dialog. the winproc in my dialog I have to catch WM_COMMAND and in that wparam is EN_VSCROLL, and the lparam is the richedit handle, so I lose the SB_THUMBPOSITION and SB_BOTTOM etc. If i subclassed the richedit and had a winproc for that i could get the WM_VSCROLL messages. but I did not want to sub class the richedit. Thanks anyway Luke

                1 Reply Last reply
                0
                • L Luke Murray

                  Hey all, I have a dialog that has a richedit control on it. I receive EN_VSCROLL messages through the WM_COMMAND message in the parent window. I can not figuer out how to catch the SB_THUMBPOSITION message. To catch the EN_VSCROLL messages I had to set the event mask SendMessage(hrichEdit, EM_SETEVENTMASK, 0, LPARAM(SendMessage(hwndDlg, EM_GETEVENTMASK, 0, 0) | ENM_SCROLL )); Any ideas? Cheers, Luke

                  L Offline
                  L Offline
                  Luke Murray
                  wrote on last edited by
                  #8

                  Well, I got it. If you add ENM_SCROLLEVENTS to the event mask, you will get the messages through WM_NOTIFY. Then the lParam is a pointer to a MSGFILTER stucture, which gives us the message code of original message, in this case WM_VSCROLL, and LOWORD(msgFilter->wparam) is the SB_* N ow this is great. Only problem now is the mouse wheel does not fire this event, but it did fire the EN_VSCROLL through WM_COMMAND. annoying. Thanks all

                  L 1 Reply Last reply
                  0
                  • L Luke Murray

                    Well, I got it. If you add ENM_SCROLLEVENTS to the event mask, you will get the messages through WM_NOTIFY. Then the lParam is a pointer to a MSGFILTER stucture, which gives us the message code of original message, in this case WM_VSCROLL, and LOWORD(msgFilter->wparam) is the SB_* N ow this is great. Only problem now is the mouse wheel does not fire this event, but it did fire the EN_VSCROLL through WM_COMMAND. annoying. Thanks all

                    L Offline
                    L Offline
                    Luke Murray
                    wrote on last edited by
                    #9

                    My bad, the wheel does fire the WM_VSCROLL through WM_NOTIFY. it did ever trigger the SB_ENDSCROLL which I was also testing for.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups