Date: 02-16-2022
Return to Index
created by gbSnippets
'Credit Dominic Mitchell
'Use the following code to check if scrollbars are visible in a window:
'can also use GETSCROLLBARINFO api
'gbs_00803
'Date: 03-10-2012
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
Function
%Unicode=1
#Include "win32api.inc"
%IDC_Plain = 500 : %IDC_ListBox = 503
Global hDlg,hListBox As Dword
Function PBMain() As Long
Local i As Long
Dialog New Pixels, 0, "ListBox Test",300,300,200,200, %WS_OverlappedWindow, 0 To hDlg
Control Add Button, hDlg, %IDC_Plain, "Check for Scrollbars", 10,10,150,20
Control Add ListBox, hDlg, %IDC_ListBox, , 10,40,180,150
Control Handle hDlg, %IDC_ListBox To hListBox
For i = 1 To 100 : ListBox Add hDlg, %IDC_ListBox, Str$(i) : Next i
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Plain
IF (GetWindowLong(hListBox, %GWL_STYLE) AND %WS_VSCROLL) THEN
? "Vertical scrollbar is visible"
Else
? "Vertical scrollbar is NOT visible"
END IF
IF (GetWindowLong(hListBox, %GWL_STYLE) AND %WS_HSCROLL) THEN
? "Horizontal scrollbar is visible"
Else
? "Horizontal scrollbar is NOT visible"
END IF
End Select
End Select
End Function
http://www.garybeene.com/sw/gbsnippets.htm