As the commenters above point out, Named Pipes (or sockets) is the way to go for this kind of solution, and it's two separate processes you probably want, not threads.
In Windows, the TransactNamedPipe()
system call helps you accomplish what you want. It's ideally suited to sending commands to a server and waiting for the response, making it easy to create a client that performs something very similar to (synchronous) remote procedure calls to a server.