SendKeys.Send()插入随机空格字符 [英] SendKeys.Send() inserting random space character

查看:114
本文介绍了SendKeys.Send()插入随机空格字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我创建了一个挂钩键盘并自动更改用户指定文本的应用程序。我已经完成了该程序并且已经编译了一个工作版本。在Windows 7上,它运行得很好。现在使用Windows 8时,似乎每隔一段时间就会在要发送的文本中间添加一个随机空间。



我试过调试代码和正确地将字符串发送到SendKeys.Send()(即使它仍未正确发送。另外,我尝试在每个字符上使用MessageBox逐个查看字符,并且它们似乎也正在发送权限字符(仍然是一个随机空间)。另外,当为每个字符使用消息框时,该功能正常工作并且没有添加空格。



想法?

So I have created an application that hooks the keyboard and auto changes text specified by the user. I have completed the program and have a working version already compiled. When on Windows 7, it worked perfectly. Now when using Windows 8, it seems to add a random space every so often in the middle of the text to be sent.

I have tried debugging the code and the string is being sent to the SendKeys.Send() correctly (even though it is still not sending correctly. Also, I tried to use a MessageBox on each character to see the characters one by one, and they also appear to be sending the right characters (still, a random space). Also, when using the messagebox for each character, the function works properly and no space is added.

Ideas?

推荐答案

现在你知道为什么使用SendKeys永远不是一个好主意。它对于生产代码来说有点过于片面。没有解决方法。
Now you know why using SendKeys is never a good idea. It''s just a bit too flaky for production code. There is no fix for it.


这篇关于SendKeys.Send()插入随机空格字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆