c# - Mouse left click and On-Screen-Keyboard -
i'm writing application using kinect windows v2 display , control mouse left hand. wrote method invoke mouse left click , works great.
i have problem 1 action. if launch on-screen-keyboard, mentioned click method not working. outside osk windows it's still works perfect. know what's going on ? here's of code.
public static void performleftclick() { input mousedowninput = new input(); mousedowninput.type = sendinputeventtype.inputmouse; mousedowninput.mkhi.mi.dwflags = mouseeventflags.mouseeventf_leftdown; sendinput(1, ref mousedowninput, marshal.sizeof(new input())); input mouseupinput = new input(); mouseupinput.type = sendinputeventtype.inputmouse; mouseupinput.mkhi.mi.dwflags = mouseeventflags.mouseeventf_leftup; sendinput(1, ref mouseupinput, marshal.sizeof(new input())); } private void showonscreenkeyboard(object sender, routedeventargs e) { var keyboardproccess = process.getprocessesbyname("osk"); if (keyboardproccess.length == 0) { process.start("c:\\windows\\system32\\osk.exe"); } }
i expect due fact windows osk runs privileges prevent other apps sending simulated input it. it's possible using 3rd party screen reader, wouldn't hit issue. also, depending on goals, might straightforward build own osk, (but can more challenging depending on number of languages want support.)
thanks,
guy
Comments
Post a Comment