by Andy Fielding (1 Submission)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating:
(2 Votes)

This demo shows how to control the width of a standard list box's text area so its widest string is always visible.
VB's list box control automatically adds a vertical scrollbar when there are too many items to show vertically. The demo detects the vertical scrollbar and includes it in the list box's width.
Inputs
(n/a)
Code Returns
(n/a)
Side Effects
A desire to do more coding, maybe...? :?)
API Declarations1. GetSystemMetrics (determines user's scrollbar size)
2. GetWindowLong (determines if listbox currently has a scrollbar)
Download Listbox resize demo (4 KB)