Author: Tomas Rutkauskas
I'm trying to ensure that a TListBox is wide enough to hold the items in it.
However, I see no method for determining if a scroll bar exists, and if so how wide
it is.
Answer:
1 procedure TForm1.FormShow(Sender: TObject);
2 var3 LBStyle: Longint;
4 begin5 LBStyle := GetWindowLong(ListBox1.Handle, GWL_STYLE);
6 if (LBStyle and WS_VSCROLL) <> 0 then7 ShowMessage(' ScrollBar visible, its width is ' +
8 IntToStr(GetSystemMetrics(SM_CYVSCROLL))
9 + ' pixels ')
10 else11 ShowMessage('ScrollBar not visible');
12 end;