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. Scroll two windows together WIN32

Scroll two windows together WIN32

Scheduled Pinned Locked Moved C / C++ / MFC
7 Posts 4 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.
  • A Offline
    A Offline
    arun_pk
    wrote on last edited by
    #1

    My application is having one Main window. Which has two child windows. I am showing the child windows side by side.Once if we scroll any of the child windows scrollbar. Both should scroll together. Please let me know if you have any idea. Thanks in advance

    _ A 2 Replies Last reply
    0
    • A arun_pk

      My application is having one Main window. Which has two child windows. I am showing the child windows side by side.Once if we scroll any of the child windows scrollbar. Both should scroll together. Please let me know if you have any idea. Thanks in advance

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      Whenever a scroll operation happens in a child window, the window will receive a WM_HSCROLL or WM_VSCROLL message depending on what scroll operation is done. To make the other child window also do the similar scroll operation you could propogate the same scroll message to the other child window from the WM_HSCROLL or WM_VSCROLL handler using PostMessage.

      «_Superman_»
      I love work. It gives me something to do between weekends.

      Microsoft MVP (Visual C++)

      Polymorphism in C

      A S 2 Replies Last reply
      0
      • _ _Superman_

        Whenever a scroll operation happens in a child window, the window will receive a WM_HSCROLL or WM_VSCROLL message depending on what scroll operation is done. To make the other child window also do the similar scroll operation you could propogate the same scroll message to the other child window from the WM_HSCROLL or WM_VSCROLL handler using PostMessage.

        «_Superman_»
        I love work. It gives me something to do between weekends.

        Microsoft MVP (Visual C++)

        Polymorphism in C

        A Offline
        A Offline
        Aescleal
        wrote on last edited by
        #3

        The trouble with forwarding messages to another window is what happens (as in the questioners case) if that window has the same behaviour? Each window will send WM_*SCROLL back and forth until someone gets bored. Cheers, Ash

        _ 1 Reply Last reply
        0
        • A arun_pk

          My application is having one Main window. Which has two child windows. I am showing the child windows side by side.Once if we scroll any of the child windows scrollbar. Both should scroll together. Please let me know if you have any idea. Thanks in advance

          A Offline
          A Offline
          Aescleal
          wrote on last edited by
          #4

          If I were you I'd stick the scroll bars on the frame window. When someone clicks the scroll bar you can scroll the child windows, either by forwarding them the scroll bar messages or using a custom message. Cheers, Ash

          1 Reply Last reply
          0
          • A Aescleal

            The trouble with forwarding messages to another window is what happens (as in the questioners case) if that window has the same behaviour? Each window will send WM_*SCROLL back and forth until someone gets bored. Cheers, Ash

            _ Offline
            _ Offline
            _Superman_
            wrote on last edited by
            #5

            The lParam for these messages are there to handle this situation.

            «_Superman_»
            I love work. It gives me something to do between weekends.

            Microsoft MVP (Visual C++)

            Polymorphism in C

            A 1 Reply Last reply
            0
            • _ _Superman_

              The lParam for these messages are there to handle this situation.

              «_Superman_»
              I love work. It gives me something to do between weekends.

              Microsoft MVP (Visual C++)

              Polymorphism in C

              A Offline
              A Offline
              Aescleal
              wrote on last edited by
              #6

              Good point, I forgot about the NULL lParam, Cheers, Ash

              1 Reply Last reply
              0
              • _ _Superman_

                Whenever a scroll operation happens in a child window, the window will receive a WM_HSCROLL or WM_VSCROLL message depending on what scroll operation is done. To make the other child window also do the similar scroll operation you could propogate the same scroll message to the other child window from the WM_HSCROLL or WM_VSCROLL handler using PostMessage.

                «_Superman_»
                I love work. It gives me something to do between weekends.

                Microsoft MVP (Visual C++)

                Polymorphism in C

                S Offline
                S Offline
                sourabhmehta
                wrote on last edited by
                #7

                Thanks.. It was really helpfull

                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