Best method to access the Console object in a Windows Forms application?
I am attempting to make my GUI a开发者_如何学Cpp have a CLI frontend (not the opposite).
I have been able to process arguments without an issue (thanks to System.Environment.GetCommandLineArgs()), but I am curious what the best way to gain access to write output to the console.
I have found reference to AllocConsole(), but it is unclear if this is the only method, as I'd much prefer something revealed in managed code.
There's also AttachConsole but that's always a mistake since it allows output to get intermingled.
AllocConsole() is it. Just creating a form that acts like a console would be the more Winformy way. With the considerable advantage that the user closing it doesn't cause your program to abort.
加载中,请稍侯......
精彩评论