Programatically scrolling a ListBox 

If a windowed control has a stnadard scrollbar (vertical, horizontal, or both), then the WM_HSCROLL or WM_VSCROLL message can be used to scroll that control vertically or horizontally, respectively. 
 

KEYWORDS: SNDMSG, WM_HSCROLL, WM_VSCROLL 
 


//---------------------------------------------------------------------------

// Scroll a ListBox vertically down
SNDMSG(ListBox1->Handle, WM_VSCROLL, SB_LINEDOWN, 0); 
 

// Other scroll parameters that can be sent... 
// SB_TOP Scrolls to the upper left.
// SB_BOTTOM Scrolls to the lower right. 
// SB_ENDSCROLL Ends scroll. 
// SB_LINEDOWN Scrolls one line down. 
// SB_LINEUP Scrolls one line up. 
// SB_PAGEDOWN Scrolls one page down. 
// SB_PAGEUP Scrolls one page up. 
// SB_THUMBPOSITION Scrolls to the absolute position. 
//                  The current position is 
//                  specified by the nPos parameter. 
// SB_THUMBTRACK Drags scroll box to the specified position. 
//               The current position is 
//               specified by the nPos parameter.