Attaching to a Console
A process can use the AttachConsole function to attach to a console as a client. A process can be attached to one console.
A console can have many processes attached to it. To retrieve a list of the processes attached to a console, call the GetConsoleProcessList function.
To attach as a server, see information about Pseudoconsoles.