Home windows Delphi SendMessage

Delphi SendMessage




Good afternoon. Launched the command line (cmd.exe ) and trying to transfer it a message that the Enter key is pressed, doing this:

 h: hwnd;
 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.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions