I have a question about how to hide a console window.
Make a .def file and include it on your dmd command line. The file only needs these two lines: EXETYPE NT SUBSYSTEM WINDOWSCall it foo.def, recompile with it on the dmd command line, and you should be in business.