c# - SetCursorPos after SetForegroundWindow -
i've got problem in c# setcursorpos, setcursorpos doesn't work after setforegroundwindow. returns error 2.
part of code:
rect patrat = new rect(); getwindowrect(parinte, ref patrat); console.writeline(setforegroundwindow(parinte)); thread.sleep(1000); console.writeline(setcursorpos(patrat.left + 10, patrat.top + 20));
but if set setcursorpos before setforegroundwindow works
and import of methods
[dllimport("user32.dll")] static extern bool setforegroundwindow(intptr hwnd); [dllimport("user32")] public static extern int setcursorpos(int x, int y); public struct rect { public int left { get; set; } public int top { get; set; } public int right { get; set; } public int bottom { get; set; } }
edit:i've discovered programme in foreground setcursorpos reject alter cursor, can ?
c# winapi dll cursor-position
No comments:
Post a Comment