如何发送“{"或“}"通过 vb 2010 中的发送密钥方法签名 [英] How to send "{" or "}" signs through send keys method in vb 2010

查看:24
本文介绍了如何发送“{"或“}"通过 vb 2010 中的发送密钥方法签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向 Visual Basic 2010 中的活动窗口发送 { 和 } 符号.但问题是当我们发送像Backspace"这样的键时,我们将其发送为{BS}".所以它也包含 { &} 迹象.因此,当我们发送 { 和 } 标志时什么也没有发生.任何人都可以帮助我...

I want to send { and } signs to the Active window in Visual Basic 2010.But the problem is when we send a key like "Backspace" we send it as "{BS}".So it also contains the { & } signs. Therefore when we send { and } signs nothing happen.Anyone help me...

推荐答案

来自

http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx

加号 (+)、脱字符 (^)、百分号 (%)、波浪号 (~) 和括号 () 对 SendKeys 有特殊意义.指定其中之一这些字符,将其括在大括号 ({}) 中.例如,到指定加号,使用{+}".要指定大括号字符,请使用{{}"和{}}". 方括号 ([ ]) 对 SendKeys 没有特殊意义,但您必须将它们括在大括号中.在其他应用中,括号确实具有特殊含义,当动态数据时可能很重要交换 (DDE) 发生.

The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses () have special meanings to SendKeys. To specify one of these characters, enclose it within braces ({}). For example, to specify the plus sign, use "{+}". To specify brace characters, use "{{}" and "{}}". Brackets ([ ]) have no special meaning to SendKeys, but you must enclose them in braces. In other applications, brackets do have a special meaning that might be significant when dynamic data exchange (DDE) occurs.

基本上,您需要将大括号加倍才能转义它们,例如

Basically, you need to double up the braces to escape them, Like

{{}

发送一个{左大括号,和

{}} 

发送右括号.乍一看可能并不明显,但这只是将大括号字符括在大括号内.这与其他转义序列一致,例如在 C/C#/etc 中使用 \\ 表示文字 \ 而不是字符串格式化字符.

to send a closing brace. It may not be obvious at first glance, but that's just enclosing a brace character within braces. This is consistent with other escape sequences, such as using \\ in C/C#/etc to indicate a literal \ instead of a string formatting character.

这篇关于如何发送“{"或“}"通过 vb 2010 中的发送密钥方法签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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