.net - C# Mouse Move and Click relative to active window -


hi have been using code similar in piece of automation have been working on

public static void leftclick(int x, int y) {     cursor.position = new system.drawing.point(x, y); //<= fails without     mouse_event((int)(mouseeventflags.leftdown), 0, 0, 0, 0);     mouse_event((int)(mouseeventflags.leftup), 0, 0, 0, 0); } 

however unless being dumb move mouse x,y top left of screen causes me problems if active window isn't im expecting be, can suggest way of achieving same functionality moving mouse point relative active window.

thanks

you need pinvoke getwindowrect() find out window located. can adjust x , y window position. visit pinvoke.net declarations.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -