我怀疑你的消息参数有问题: SB_THUMBPOSITION-The user has dragged the scroll box (thumb) and released the mouse button. The high-order word indicates the position of the scroll box at the end of the drag operation. SB_THUMBTRACK-The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The high-order word indicates the position that the scroll box has been dragged to.
::SendMessage(m_list.m_hWnd,WM_VSCROLL,HTVSCROLL,(LPARAM)100);
SB_THUMBPOSITION-The user has dragged the scroll box (thumb) and released the mouse button. The high-order word indicates the position of the scroll box at the end of the drag operation.
SB_THUMBTRACK-The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The high-order word indicates the position that the scroll box has been dragged to.
{
m_ctrlListCtrl.SetFocus();
m_ctrlListCtrl.SetCapture();
m_ctrlListCtrl.SendMessage(WM_SYSCOMMAND,SC_VSCROLL,0);
m_ctrlListCtrl.SendMessage(WM_VSCROLL,MAKELONG(SB_THUMBTRACK,10),0);
m_ctrlListCtrl.SendMessage(WM_VSCROLL,MAKELONG(SB_ENDSCROLL,0),0);
ReleaseCapture();
}
上面是我的测试代码。
if( hwnd )
{
CScrollBar* pBar = CWnd::FromHandle(hwnd);
}
if( hwnd )
{
CScrollBar* pBar = (CScrollBar*)CWnd::FromHandle(hwnd);
}
只是用的方法是修改ListCtrl。