You can move mouse cursor and simulate clicking programmatically using just one simple procedure.
procedure TForm1.Button1Click(Sender: TObject); begin SetCursorPos(20, Screen.Height-20); //set cursor to Start menu coordinates mouse_event(MOUSEEVENTF_LEFTDOWN,0, 0, 0, 0); //press left button mouse_event(MOUSEEVENTF_LEFTUP,0, 0, 0, 0); //release left button end;
To simulate right button, use MOUSEEVENTF_RIGHTDOWN and MOUSEEVENTF_RIGHTUP
parameters.
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου