No announcement yet.

Scroll Bar Messages

  • Filter
  • Time
  • Show
Clear All
new posts

  • Scroll Bar Messages

    I have been trying to teach myself how to use the ScrollBar control, as opposed to a window with the ScrollBar Style. So far, I feel I am making good progress. Processing the %WM_Sizing and %WM_Size messages, I was able to create a Horizontal and Vertical ScrollBar which would resize and maintain perspective with the window as you drag the edge of the window. Tool me a while to get it. My aim (in this example) is to scroll an oversized Child Window of the Main window. Fred Harris gives an excellent example of exactly what I am trying to achieve in this reply. In this example, Fred uses a window with %WS_HScroll Or %WS_VScroll style.
    My problem is this. If I size the child window, szPanelName = "Panel", so that it is smaller than the main window and does not pass beneath the ScrollBar controls, then WinProc Does receive the %WM_HScroll and %WM_VScroll messages, so I may process these messages but, if I size the child window so that it is larger than the main window and passes beneath the ScrollBar controls, then WinProc does NOT receive the %WM_HScroll and %WM_VScroll messages, even though the ScrollBar controls are children of the Main Window.
    I create the Scroll Bars last so that so they remain on to of the "Panel" window. Maybe, this is not the correct technique.
    In the attached .zip file, if you change rc.Right*.75, rc.Bottom*.75 in hSPanel = CreateWindowEx(0, "Panel", to rc.Right*1.75, rc.Bottom*1.75, the problem arises. The ScrollBars do nothing at this stage but you will see that the ScrollBar Thumb does resize to reflect the larger size to the child window. I am OK with the use of the ScrollInf Structure.
    All advice welcome, but not by just showing Full completed code please. Code snippets and advice on different API procedures more than welcome.

    Thank You
    Gavin Fitz-Henry
    Attached Files