Date: Feb 5, 2013 9:27 PM
Author: Paul Mennen
Subject: Hiding or minimizing a dos window

I'm redirecting the output of a dos program (under Win7x64) to a text file with:

dos('DosProgram parameters > output.txt &');

This works well except for the fact that I want to hide or minimize the dos window.
I've read that this can be done by using some combination of parameters with the start command and/or cmd.exe, but if so it must require some magical combination that I haven't yet discovered. I've tried hundreds of dos(' ') commands but none of them has done the right thing. Sometimes two dos windows are created and only one of them is minimized, and sometimes the redirection doesn't work. So I've pretty much given up hope on that approach unless someone knows exactly how it is done.

I have downloaded a program called WindowAPI which can minimize a window given its HWND handle. I've found that this works for a matlab figure since this same program can be used to find the HWND handle of a matlab figure. It probably would work on a console window as well if I could pass in the HWND handle of the console window, but unfortunately I don't know how to find this handle. Does anyone know how to do this?

Thanks
~Paul