给列表控件发WM_VSCROLL消息的问题

flyhigh 2006-07-24 02:35:05
我在模拟列表控件的滚动条消息时给列表控件发WM_VSCROLL消息。其它CODE都正常,但是SB_TRUMBTRACK和SB_TRUMBPOSITION不起作用。通过Spy++跟踪内部滚动条发的消息,记录发消息序列,我再一一重复也不行。
没有办法,只有向各位大侠求助了!
...全文
883 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
flyhigh 2006-07-26
  • 打赏
  • 举报
回复
问题已经解决。
只是用的方法是修改ListCtrl。
Practise_Think 2006-07-25
  • 打赏
  • 举报
回复
确认相应的参数值
mynamelj 2006-07-25
  • 打赏
  • 举报
回复
HWND hwnd = FindWindow(...);
if( hwnd )
{
CScrollBar* pBar = (CScrollBar*)CWnd::FromHandle(hwnd);
}
mynamelj 2006-07-25
  • 打赏
  • 举报
回复
外部也可以啊

HWND hwnd = FindWindow(...);
if( hwnd )
{
CScrollBar* pBar = CWnd::FromHandle(hwnd);
}
flyhigh 2006-07-24
  • 打赏
  • 举报
回复
我是想通过在外面模拟滚动条消息来滚动窗口。所在不能用GetScrollBarCtrl()
mynamelj 2006-07-24
  • 打赏
  • 举报
回复
直接用GetScrollBarCtrl()进行操作不行吗?
flyhigh 2006-07-24
  • 打赏
  • 举报
回复
void CScrollDlg::OnButton3()
{
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();
}
上面是我的测试代码。
flyhigh 2006-07-24
  • 打赏
  • 举报
回复
参数没有问题。因为在其它如树控件上能够正常运行。
LegerWu 2006-07-24
  • 打赏
  • 举报
回复
我怀疑你的消息参数有问题:
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.
DentistryDoctor 2006-07-24
  • 打赏
  • 举报
回复
主要看参数
xjtuzhw 2006-07-24
  • 打赏
  • 举报
回复
有个HTVSCROLL,你试下发送:
::SendMessage(m_list.m_hWnd,WM_VSCROLL,HTVSCROLL,(LPARAM)100);

king820802 2006-07-24
  • 打赏
  • 举报
回复
你可以把消息截获看看具体是什么参数,然后再模拟!
应该是你消息的值有问题

15,976

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧