I am trying to send keystrokes to cmd.exe that I run from my application. With this I can send all the keyboard characters, but if I try to send Backspace, this does not seem to take effect. The following is a snippet of code for sending cmd.exe messages:
SendMessage((int)shell.MainWindowHandle, WM_KEYDOWN, ((int)e.KeyCode), 0); SendMessage((int)shell.MainWindowHandle, WM_KEYUP, ((int)e.KeyCode), 0);
Any idea why this won't work? What is the best way to send stdin from cmd.exe from a C # application?
early
You will need P / Invoke SendInput () , because Backspace is handled directly using the keyboard driver.
string msg = "Hello Cmd";
int i=0; for (i=0; i < msg.Length ; i++)
int i=0;
for (i=0; i < msg.Length ; i++)
SendMessage(cmdHwnd, WM_CHAR, (int)msg[i], 0);
, CAPS Space.
, , - , , , , , "", chanel, channel. .
Murali KEYDOWN KEYUP KeyCode.
,
use ascii code: backspace -> OCT 0x10, char 'BS'
Source: https://habr.com/ru/post/1722791/More articles:The most optimized way to store crawler states? - optimizationmySQL - apply row level lock with mysqli - phpJFreeChart in scrollpane - javaUsing Unreal 3 Engine in a .NET Application - .nethttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1722790/what-are-the-possible-ways-to-prevent-form-from-double-posting-in-aspnet-mvc&usg=ALkJrhiYx-fm5BlpUUkrcITOFr8HGeOpYQAccess to object members and atomicity - c #How to choose DBIx :: Class? - perlNHibernate criteria using predictions for a substring with an attachment - nhibernateC # Getting common methods - genericsDataView NullReferenceException in OnListChanged - c #All Articles