Universal Windows Platform (UWP)
A Microsoft platform for building and publishing apps for Windows desktop devices.
2,989 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
void HandleCharKeyPress(Button button)
{
InputInjector inputInjector = InputInjector.TryCreate();
var ch = button.Content.ToString();
string upperCaseStr = ch.ToUpper();
bool isUpperCase_srcSame = ch.Equals(upperCaseStr);
if(upperCaseStr==".COM")
{
isUpperCase_srcSame = true;
}
#region lower case Alphabets
if (isUpperCase_srcSame == false)
{
//Lower case
var key = new InjectedInputKeyboardInfo();
if (ch.Equals("a"))
{
key.VirtualKey = (ushort)(VirtualKey.A);
}
else if (ch.Equals("b"))
{.......so on
//https://stackoverflow.com/questions/48879320/uwp-injectedinputkeyboardinfo-how-to-send-non-english-keystrokes
else if (ch.Equals("#") || ch.Equals("$") || ch.Equals("%") || ch.Equals("^") || ch.Equals("&")
|| ch.Equals("@") || ch.Equals("(") || ch.Equals(")") || ch.Equals("_") || ch.Equals(":")
|| ch.Equals(";") || ch.Equals(",") || ch.Equals(".") || ch.Equals("!") || ch.Equals("?")
|| ch.Equals("[") || ch.Equals("]") || ch.Equals("{") || ch.Equals("}") || ch.Equals("~")
|| ch.Equals("`") || ch.Equals("=") || ch.Equals("|") || ch.Equals("'") || ch.Equals("\"")
|| ch.Equals("\\") || ch.Equals("<") || ch.Equals(">"))
{
char c = ch[0];
reqKey.ScanCode = (ushort)c;
@reqKey.KeyOptions = InjectedInputKeyOptions.Unicode;
}
else if(ch.Equals(".com"))
{
char c = ch[0];
reqKey.ScanCode = (ushort)c;
@reqKey.KeyOptions = InjectedInputKeyOptions.Unicode;
}
here I cant able to take the ".com" either iget "." or using foreach getting "m", please help me to take out the whole ".com"