C# 中的 keybs_event 不模拟逗号
我有一个在 Windows Mobile 6.1 设备上运行的 C# 程序。它需要将逗号分隔的列表打印为键盘事件,以便用户可以将它们转储到当时打开的任何程序中。然而, keybd_event 方法忽略了逗号,只是一个接一个地打印出数字。这是一个示例,其中硬编码了一个数字:
byte[] bBuf = Encoding.ASCII.GetBytes("22108,");
for (int i = 0; i < bBuf.Length; i++)
{
System.Diagnostics.Debug.WriteLine("buffer: " + bBuf[i]);
keybd_event(bBuf[i], 0x00, keyFlag.KEYEVENTF_KEYDOWN, 0);
System.Threading.Thread.Sleep(2);
keybd_event(bBuf[i], 0x00, keyFlag.KEYEVENTF_KEYUP, 0);
System.Threading.Thread.Sleep(2);
}
这将打印出“22108”。
逗号字符有什么特殊之处导致它被忽略吗?如果是,我该如何解决这个问题?
I have a C# program which is running on a windows mobile 6.1 device. It needs to print out comma delimited lists as keyboard events so that the user can dump them into whatever program is open at the time. However, the keybd_event method is ignoring the commas and just printing out the numbers one after another. Here is a sample with a number hard coded into it:
byte[] bBuf = Encoding.ASCII.GetBytes("22108,");
for (int i = 0; i < bBuf.Length; i++)
{
System.Diagnostics.Debug.WriteLine("buffer: " + bBuf[i]);
keybd_event(bBuf[i], 0x00, keyFlag.KEYEVENTF_KEYDOWN, 0);
System.Threading.Thread.Sleep(2);
keybd_event(bBuf[i], 0x00, keyFlag.KEYEVENTF_KEYUP, 0);
System.Threading.Thread.Sleep(2);
}
This will print out "22108".
Is there something special about the comma character which causes it to be ignored and if so, how do I get around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须传递 0xBC 作为逗号 - 请查看 http://msdn.microsoft.com/en-us/library/dd375731(v=vs.85).aspx
You have to pass 0xBC for comma - check this out http://msdn.microsoft.com/en-us/library/dd375731(v=vs.85).aspx