Hello fellow programmer, I have a problem with some console applications in the C ++ program, and my motto is as follows.
P>
- First create CMD windows.
- Run an order. (System ("Print some error text");)
- Create another CMD window.
- Change the system (...) Focus on the other CMD window.
- Execute a command.
- Change the system (...) First focus on the CMD window.
- Perform an order.
The final goal will be executed by a CMD application that will create another CMD window, execute a command on it, and then focus on the original CMD window to execute the other code. Will return I do not need to keep track of the window, or be able to return it. Just create a new window, switch focus to it, execute a command, return focus to the original window.
- When the first CMD window is created, the app will start.
- Execute a command on this window with the system (...); works fine.
-
I am creating a second CMD window with
HWND new_hWnd = NULL; Shellexequeut (new_hand, "open", "cmd.exe", noull, null, SWSHHOO);
- This is where I have problems, I am not able to redirect the system (...) into a separate CMD window, and this is the part that I need help because if I can understand it, it will be easy to complete the steps 5, 6 and 7.
I have tried this online research and have not been able to "pipe" but reproduce them, or understand them. Also, I noticed that
is GetConsoleWindow ();
The function that gives a handle for the current CMD window, there are some indications for me that the CMD should be a way of switching between windows while using the handle, but since I The second CMD window I have not concentrated I can not call to get that function to handle
So, how can I create systems (...) target different CMD windows with handles? If this is not possible, how can I apply this "pipe" system?
If the latter is the latter, please try to make it as detailed and simple as possible, because every example I found online is really big and difficult / read / understand
If there is no easy way to implement "pipes" then please post or provide me the best (something that will help me to work in the pipes) you can find and I work with it I will continue to thank you, thank you in advance!
You can create a new console for the new process by specifying
.
- Process flags:
- Process Function:
- This is where I have problems, I am not able to redirect the system (...) into a separate CMD window, and this is the part that I need help because if I can understand it, it will be easy to complete the steps 5, 6 and 7.
No comments:
Post a Comment