Harold Hunt wrote: >That's a tricky one. I admit that it would be great to be able to toggle between logged >output and console output. However, there is an issue that stands in the way. The >problem is that we have to make a choice between the X Server being a Windows >executable or a DOS executable. DOS executables open that annoying DOS box >that doesn't do anything if you are logging to a file. Windows executables don't open >a DOS box in any circumstance, even when you want to output to the console.
> >That gives us a dilemma because we can't have a Windows executable that allows >console output, yet we don't want a DOS executable for when we are logging to a file. That's actually not quite true. Graphics applications can create and attach to a console and then use standard in and standard out, etc, just like a console program. Here is the URL for the MSDN pages for the console API: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/conchar_5ehx.asp I've never actually worked with this API, so I can't tell you exactly what sequence of calls to make to, but it looks like you pretty much just call AllocConsole and start printing. You may have to SetStdHandle with appropriate values for standard in and out to be wired properly, but I'm guessing that if you just AllocConsole it will set decent defaults. Then, when you're done (or when the user wants to get rid of the console), just FreeConsole. I'm pretty sure that you don't need to use any of the low level console IO functions, so you can probably ignore most of what's there. Hope this helps. Cheers- Augustus
