码迷,mamicode.com
首页 > 其他好文 > 详细

发送鼠标滚轮消息

时间:2020-06-30 14:50:46      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:pos   else   mouse   result   鼠标   code   proc   object   int   

procedure SendMouseWheel(destHandle: THandle; goUp: Boolean);
var
  message: TWMMouseWheel;
  delta: SmallInt;
begin
  if goUp then
    delta := WHEEL_DELTA
  else delta := -WHEEL_DELTA;

  message.Msg := WM_MOUSEWHEEL;
  message.Keys := 0;
  message.XPos := 0;
  message.YPos := 0;
  message.Result := -1;
  message.WheelDelta := delta;
  SendMessage(destHandle, WM_MOUSEWHEEL, TMessage(message).WParam, TMessage(message).LParam);
end;

procedure TForm2.BitBtn1Click(Sender: TObject);
begin
  SendMouseWheel(Memo1.Handle, True);
end;

procedure TForm2.BitBtn2Click(Sender: TObject);
begin
  SendMouseWheel(Memo1.Handle, False);
end;

 

发送鼠标滚轮消息

标签:pos   else   mouse   result   鼠标   code   proc   object   int   

原文地址:https://www.cnblogs.com/onlyou13/p/13213461.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!