Click here to Skip to main content
15,910,123 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I want to know how to Send key to console that has no Windows with RedirectStandardOutput enabled?
Thanks.

Edit : ( the console I'm using support Input method )
The reason is that I'm making a GUI application that run a console application
and fetch it's output in real-time, and that console support input method ( like pressing P to pause\resume, C to cancel )
If I set the process windows to hidden it does not work, so I used CreateNoWindows to hide it, but unfortunately I cannot send any key to the console application when CreateNoWindows enabled.
Posted
Updated 5-Dec-15 3:31am
v2
Comments
Sergey Alexandrovich Kryukov 5-Dec-15 5:52am    
Why? It does not seem to make any sense.
—SA
Leecherman 5-Dec-15 6:48am    
I'm making a GUI application that run a console application
and fetch it's output in real-time, and that console support input method ( like pressing 'P' to pause\resume, 'C' to cancel )
If I set the process windows to hidden it doesn't work, so I used CreateNoWindows to hide it, but unfortunately I cannot send any key to the console application when CreateNoWindows enabled.
phil.o 5-Dec-15 12:32pm    
You create a console just to be able to respond to key strokes?
Leecherman 5-Dec-15 14:19pm    
I'm using a 3rd party console, not created by me...
and I want to read it's output in real-time and also i want to send keys to it!
Sergey Alexandrovich Kryukov 5-Dec-15 18:54pm    
You did not answer my question: why?
—SA

1 solution

Ummm...I may be touching on the obvious, but since you redirected StandardOutput, did you also redirect StandardInput as well? All you have to do is Write the input you want.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900