How Do I Use SendInput in Delphi?

对着背影说爱祢 提交于 2019-12-03 03:55:11

Here is how to simulate a left click for more details visit http://msdn.microsoft.com/en-us/library/ms646310(VS.85).aspx

var
eu: array [0..1] of TInput;
begin
  ZeroMemory(@eu,sizeof(eu));
  eu[0].Itype := INPUT_MOUSE;
  eu[0].mi.dwFlags :=MOUSEEVENTF_LEFTDOWN;
  eu[1].Itype := INPUT_MOUSE;
  eu[1].mi.dwFlags :=MOUSEEVENTF_LEFTUP;
  SendInput(2,eu[0],sizeof(TInput));
end;

And here is for simulating right click

var
eu: array [0..1] of TInput;
begin
  ZeroMemory(@eu,sizeof(eu));
  eu[0].Itype := INPUT_MOUSE;
  eu[0].mi.dwFlags :=MOUSEEVENTF_RIGHTDOWN;
  eu[1].Itype := INPUT_MOUSE;
  eu[1].mi.dwFlags :=MOUSEEVENTF_RIGHTUP;
  SendInput(2,eu[0],sizeof(TInput));
end;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!