I was using the Mouse_Event
Function in Delphi 2009, but the Delphi documentation says this function has been superceded and to use SendInput
instead.<
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;