How can I notify an application of a programmatically set scrollbar value?

Posted by Frerich Raabe on Stack Overflow See other posts from Stack Overflow or by Frerich Raabe
Published on 2010-06-11T13:12:19Z Indexed on 2010/06/11 13:23 UTC
Read the original article Hit count: 166

Filed under:
|
|
|

My code involves standard Scroll Bar control and it happens that I need to change its value programmatically in some cases. I do this using SetScrollInfo function, as in this example:

void setScrollBarValue( HWND scrollBar, int value )
{
    SCROLLINFO si = { sizeof( SCROLLINFO ); }
    si.fMask = SIF_POS;
    si.nPos = value;
    ::SetScrollInfo( scrollBar, SB_CTL, &si, true /* redraw */ );
}

This appears to work fine (the thumb of the scrollbar moves around) but it fails to notify the rest of the application of the new scrollbar value. For instance, an edit control which uses the scroll bar (much like in the Windows notepad application) fails to scroll around because it doesn't get notified about the new scrollbar value.

In case it matters: the scrollbar I'm modifying is not in the same process as the above setScrollBarValue function.

Does anybody know how to achieve this?

© Stack Overflow or respective owner

Related posts about winapi

Related posts about win32