onlyou13

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
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;

 

posted on 2020-06-30 14:10  onlyou13  阅读(633)  评论(0编辑  收藏  举报