Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
296 views
in Technique[技术] by (71.8m points)

c# - How to embed a Console application inside a Winforms application

I'm developing an application which acts as a GUI for Minecraft Server (runs as a console Java application).

I have finished it and I also want to add a console inside the Winforms application because I want to give users more control over the program. But using streams (Process.StandardOutput) I can't simulate a console as it sometimes changes the cursor position, clears the console, etc...

So, I want to embed the process into the application somehow. The first solution I tried was removing the borders and positioning it accordingly to the form's position but unfortunately I couldn't do it.

Any working code snippets would be greatly appreciated!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You cannot target both subsystem gui and console in the same module (msdn).

Instead, you could add a separate console application that uses SOAP to communicate with your application. Take a look at WCF to achieve this task.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...