Is there an alternative for the SendKeys class that will work with Windows 10

不想你离开。 提交于 2019-12-11 15:06:46

问题


I cannot find any definitive information anywhere but the System.Windows.Forms.SendKeys class appears to have been blocked / disabled / depreciated in Windows 10.

I wrote a demo program that monitors the users keystrokes and if a user enters a known code it will pop up a form and then go off to a document database and return various strings (company names / addresses / contact lists etc) and replace the typed code with the retrieved string. SendWait is used to send the retrieved strings to whatever program typed the code.

I built the program on the companies Windows 7 desktops but when I ran it on my personal Windows 10 system it didn't work. A lot of reading later and I feel like a complete idiot but I cant let them take this project any further knowing that they wont be on Win7 forever.

So my question is has this sort of functionality definitely been disabled in Windows 10 or is there another way or method I would be able to use to achieve this behavior of inserting text into running programs.

Any help appreciated.


回答1:


I found this Forum-Thread:

https://www.tenforums.com/software-apps/49635-sendkeys-not-working-windows-10-a.html

SendKeys is Blocked in W10. In W8.1 it still works.
There are other anoying things, like not allowing App to Read or Wright to Drive C. The "file" is there but W10 "hides" it or simply not allowing to access it.
There are Netwok problems also, not allowing App to work on LAN environement.
Well, my opinion is that W10 behaves like Malware to user PC. Useless.

They had no solution.




回答2:


It looks as if Sendkeys works with some apps and not others. I can automate an older app by sending it keystrokes but newer apps like Chrome don't respond. The inconsistent behavior has seriously messed up scripts that worked fine under Win 7.

I have not found any official documentation that says that Sendkeys has been deprecated so the inconsistency looks to be a Windows 10 bug.



来源:https://stackoverflow.com/questions/50404327/is-there-an-alternative-for-the-sendkeys-class-that-will-work-with-windows-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!