I'm trying to send an underscore with PostMessage but the best I can get is -, can anyone help here I cannot find the answer anywhere.
I send a string to a character loop that gets each one and uses PostMessage to send the key, which works fine for almost everything but I cannot figure out _.
public bool SendKeys(string message)
{
var success = false;
uint wparam = 0 << 29 | 0;
foreach (var child in GetChildWindows(Window.Windowhandle))
{
var sb = new StringBuilder(100);
GetClassName(child, sb, sb.Capacity);
//(IntPtr)Keys.H
if (sb.ToString() != Window.TargetWindow) continue;
foreach (var c in message)
{
var k = ConvertFromString(c.ToString());
if (String.Equals(c.ToString(), c.ToString().ToUpper(), StringComparison.Ordinal))
{
PostMessage(child, WM_CHAR, (IntPtr) k, (IntPtr) wparam);
}
else
{
PostMessage(child, WM_KEYDOWN, (IntPtr)k, (IntPtr)wparam);
}
success = true;
Thread.Sleep(200);
}
}
return success;
}
ConvertFromString is just (Keys)Enum.Parse(typeof (Keys), keystr); really, getting the key from System.Form.Keys
Can anyone identify how to send an underscore??