Hi,
As you know, a scrollbar automaticaly appears on a listbox.
I'm just trying to detect in my app. when this scrollbar appears, thats all...
Thanks.
Printable View
Hi,
As you know, a scrollbar automaticaly appears on a listbox.
I'm just trying to detect in my app. when this scrollbar appears, thats all...
Thanks.
Try checking for the WS_VSCROLL Flag in the Listbox's Window Style, ie.
------------------Code:'Add a Timer, a Listbox and 2 Command Buttons to a Form..
'
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const WS_VSCROLL = &H200000
Private Sub Form_Load()
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
'Check if the Listbox has the WS_VSCROLL Style
Caption = IIf(GetWindowLong(List1.hwnd, GWL_STYLE) And WS_VSCROLL, "Scrollbar Visible", "Scrollbar Hidden")
End Sub
Private Sub Command1_Click()
'Add an Item to the List
List1.AddItem "Item " & List1.ListCount + 1
End Sub
Private Sub Command2_Click()
'Remove an Item from the List
List1.RemoveItem List1.ListCount - 1
End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Certified AllExperts Expert
Thanks a lot.
Claude.