What I meant was that getconsolewindow will only work if run from inside an app thats running through the console, it will get the console window its running in....it wont get the console window of something you run from your app.
So I think your going to have to do something like run the cli app through cmd and get thats hwnd.
Find attached a little demo I made for you.