Declare Function SendMessage Lib "user32" Alias
"SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long,
ByVal wParam As Long, lParam As Long) As Long
Const WM_USER = &H400
Const LB_SETHORIZONTALEXTENT = WM_USER + 21
Sub CheckListBox
dim
i%, res&
dim
Scrollwidth&
For i% = 0 To Form1.List1.ListCount
If Form1.TextWidth(Form1.List1.List(i%)) > Scrollwidth& Then _
Scrollwidth& = Form1.TextWidth(Form1.List1.List(i%))
Next i%
res& = SendMessage(Form1.List1.hWnd, LB_SETHORIZONTALEXTENT, _
Scrollwidth&, 0&)
End Sub
Call this procedure
everytime the content
of the listbox has changed.
Return