Good afternoon. Launched the command line (cmd.exe
) and trying to transfer it a message that the Enter
key is pressed, doing this:
var
h: hwnd;
Begin.
Shellexecute (0, 'Open', 'Cmd.exe', '/ K', Nil, SW_SHOW);
H: = FindWindow (0, 'C: \ Windows \ System32 \ cmd.exe');
SendMessage (H, VK_RETURN, NIL, NIL);
Why C: \ Windows \ System32 \ Cmd.exe
? Yes, because, this is the name of the schoo window).
But this way does not want to work, maybe there are more options?
Answer 1, Authority 100%
Console applications have no window cycle, because any Send / PostMessage for them is an empty sound.
Open input / output streams via OpenProcess or CreateProcess, and transmit the Enter press symbol there.