Problems with GetScrollInfo( )

Posted on 2009-04-21
Last Modified: 2012-05-06
I have an application which displays a screen with a scroll bar and I need to determine if the user has scrolled all of the way to the bottom of the scroll list.  I have everything working using the "Windows XP Style" appearance Theme, but once I switch to the "Classic Windows" Theme the GetScrollInfo( ) function is returning zero values for all of the SCROLLINFO properties.  

Would anyone know why GetScrollInfo( ) would return "0" for all of the SCROLLINFO properties (e.g. nMax, nPage)?

I have attached my code.  The language is CA-Visual Objects, but the language should be irrelevant.
if ( xitem = SB_THUMBTRACK ) 

                        wCurrPos := HiWord( wParam ) 



                        //      Get the current thrumb track position



                        ScrollInfo.fmask := SIF_ALL

                        GetScrollInfo( GetDlgItem( GetParent( hnd ), 601 ), SB_VERT, @ScrollInfo )



                        //      Calculate the maximum scroll position.  



                        ListBoxMaxPos := ( ( ScrollInfo.nMax - ScrollInfo.nPage ) + 1 )



                        //      If the thumb track is at the bottom of the scrollbar then enable the "Yes" buttton, otherwise disable the button.



                        if ( ListBoxMaxPos == wCurrPos )

                                EnableWindow( GetDlgItem( GetParent( hnd ), 702 ), TRUE )


                                EnableWindow( GetDlgItem( GetParent( hnd ), 702 ), FALSE )


Open in new window

Question by:turasque
    LVL 39

    Assisted Solution

    I haven't coded in Delphi for years (assuming it is Delphi), but when GetScrollInfo fails, the return value is zero. Can you test for the return value and, if zero, call GetLastError and see what it returns?

    Accepted Solution


    Thank you for your suggestion.  The code is in CA-Visual Objects (Computer Associate's version of Clipper).

    I tried GetLastError() but unfortunately it returns successfully in both themes.  I believe it is a problem with the CA-Visual Object's Win32 API library DLL.  I tried a C++ program using the CListCtrl which works in both themes, so this points to something wrong with the CA-Visual Objects compiler.
    LVL 39

    Expert Comment

    Missed the follow-up... Have you managed to workaround these problems using C++, or do you still seek assistance here?

    Author Comment

    I think I am all set.  I am going to use my C++ solution.  Thanks again for your assistance!
    LVL 39

    Expert Comment

    You're welcome. No objections here to the closing proposal ;)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
    This article will show, step by step, how to integrate R code into a R Sweave document
    The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now