开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜