add a horizontal scroll bar to a listbox or combo

By | 2002-06-01

add a horizontal scroll bar to a listbox or combo box

Original Author: VB Qaid

API Declarations

#If Win16 Then
Declare Function SendMessage Lib “User” (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long
#Else
Declare Function SendMessage Lib “user32” Alias “SendMessageA” (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
#End If

Code

Const WM_USER = 1024
Const LB_SETHORIZONTALEXTENT = (WM_USER + 21)
Dim nRet As Long
Dim nNewWidth As Integer
nNewWidth = list1.Width + 100 'new width in pixels
nRet = SendMessage(list1.hwnd, LB_SETHORIZONTALEXTENT, nNewWidth, ByVal 0&)

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.