[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1251
  • Last Modified:

Problems with GetScrollInfo( )

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 )
                        else
                                EnableWindow( GetDlgItem( GetParent( hnd ), 702 ), FALSE )
                        end

Open in new window

0
turasque
Asked:
turasque
  • 3
  • 2
2 Solutions
 
abelCommented:
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?
0
 
turasqueAuthor Commented:
abel,

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.
0
 
abelCommented:
Missed the follow-up... Have you managed to workaround these problems using C++, or do you still seek assistance here?
0
 
turasqueAuthor Commented:
I think I am all set.  I am going to use my C++ solution.  Thanks again for your assistance!
0
 
abelCommented:
You're welcome. No objections here to the closing proposal ;)
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now