I am making a program that calls another program, and then it needs the output of that program (which is normally directed to that program's console window's stdout) to be redirected to my program's stdin. I will need to use SetStdHandle in my program, but here's the problem. To get the value to use with SetStdHandle, I will need to call something GetStdHandle, but not actually GetStdHandle, because GetStdHandle gets the handle for my program's console, not for the called program's console. I need some API function that I can call, that has the other program's process handle as one of the parameters so that I can get the stdout handle of the other program, and redirect it to the stdin of my program.