I find it very interesting when I can control a console window with my C#/C++ program.
According to this post: Programmatically Paste Clipboard Text to a CMD Window (C# or C++), we can execute paste command for a console with this code
// hwnd is the window handle of a console window
SendMessage(hwnd, WM_COMMAND, 0xfff1, 0);
So 0xfff1 is the command (wParam) for Paste. But I see that there are several useful commands:
Copy
Select All
Paste ---> 0xfff1
Execute command (When you press Enter to execute a cmd command)
Clear current input (when you press Esc)
Ctrl + C command (you know what that is, not copy btw)
If I have the execute command, then I can combine paste & execute to programmatically execute a command in a console from my software. Or if I know "Select All" & "Copy", I can programmatically copy the content of the console.
So does anyone know the programmatic command code (wParam) of the command above? Especially the execute command.