Can't do PostMessage() with SB_THUMBPOSITION

Why doesn't PostMessage() work with

MAKEWPARAM(SB_THUMBPOSITION,mylistctrl.GetTopIndex() +1, NULL); // fails

I can do post WM_VSCROLL for notifications of SB_PAGEUP/DOWN/LINEUP/DOWN but not for SB_THUMBTRACK.

I have a real problem where I need to
post or send SB_THUMBPOSITION notification.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Tommy HuiConnect With a Mentor EngineerCommented:
Most likely the reason is the control has not seen a WM_LBUTTONDOWN message. Usually, most windows will maintain a flag that tells them whether the mouse button is up or down. If it is down, then they will respond to particular messages. If not, then they won't. I bet SB_THUMBPOSITION would be one of them. So the sequence to try is

  PostMessage(WM_LBUTTONDOWN, ...);
  PostMessage(WM_VSCROLL, ...);
  PostMsesage(WM_LBUTTONUP, ...);
kkrueckeAuthor Commented:
Edited text of question.
kkrueckeAuthor Commented:

Thanks for your answer. I believe you are correct, windows is keeping track of whether the scrollbar button is down.

I will test your solution.  I wonder: if I send WM_LBUTTONDOWN, do I then have to send WM_MOUSEMOVE?

Anyway, what I am really trying to accomplish is, scroll two adjacent list view controls using only one scrollbar, the the scroll bar would be attached to the right-most control.  This is a product requirement.  I have a OnVScroll() handler, and in it I do the SendMessage() to the other list view control. For case SB_THUMBTRACK, I send WM_LBUTTONDOWN, won't the focus change to the other list view control?  
I guess, I have to try alternating the focus--after I test your proposed solution.

All Courses

From novice to tech pro — start learning today.