I think that Windows might allow you to access STDIN only from the main thread. This is at least the normal convention in Windows GUI programming.
I am not sure if this is the only issue in your code, but you may consider to change your code accordingly and check if it will work then.
I got the code for a non-blocking read from Re^3: Non Blocking input on Win32 platforms. My original idea was ultimately to replace the usage of STDIN CLI with a GUI thread passing messages to a boss/worker model, since I don't want to surrender execution control to the GUI.