The TBM_GETRANGEMAX message retrieves the maximum position for the slider in a trackbar.
TBM_GETRANGEMAX wParam = 0; lParam = 0;
Returns a 32-bit value that specifies the maximum position in the trackbar's range of minimum to maximum slider positions.