Originally Posted by
MSDN: About Trackbar Controls
A trackbar notifies its parent window of user actions by sending the parent a WM_HSCROLL or WM_VSCROLL message. A trackbar with the TBS_HORZ style sends WM_HSCROLL messages. A trackbar with the TBS_VERT style sends WM_VSCROLL messages. The low-order word of the wParam parameter of WM_HSCROLL or WM_VSCROLL contains the notification code. For the TB_THUMBPOSITION and TB_THUMBTRACK notifications, the high-order word of the wParam parameter specifies the position of the slider. For all other notifications, the high-order word is zero; send the TBM_GETPOS message to determine the slider position. The lParam parameter is the handle to the trackbar.
So to get the three required bits of information we have:
Code:
case WM_HSCROLL:
int ctrlID = GetDlgCtrlID((HWND) lParam);
int requestID = LOWORD(wParam);
int position = SendMessage((HWND) lParam, TBM_GETPOS, 0, 0);
switch (requestID)
{
case TB_LINEUP:
{
switch (ctrlID)
{
case TRACKBAR1:
...
case TRACKBAR2:
...
}
}
}