469,269 Members | 1,006 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,269 developers. It's quick & easy.

Is it possible to embed a console window c#?

Curious how you could embed a console in a Windows form.. any ideas ?

Oct 17 '07 #1
7 11695
On Oct 17, 9:50 am, ScottH <scott.ho...@gmail.comwrote:
Curious how you could embed a console in a Windows form.. any ideas ?
In the past I've done this using the AllocConsole API.

Oct 17 '07 #2
Yeah I got the console to show up that way. It comes up as a separate
window from my forms. I wanted to embed it in a form, any idea how to
do that?

On Oct 17, 11:07 am, Brian Gideon <briangid...@yahoo.comwrote:
On Oct 17, 9:50 am, ScottH <scott.ho...@gmail.comwrote:
Curious how you could embed a console in a Windows form.. any ideas ?

In the past I've done this using the AllocConsole API.

Oct 17 '07 #3
ScottH wrote:
Yeah I got the console to show up that way. It comes up as a separate
window from my forms. I wanted to embed it in a form, any idea how to
do that?
I am afraid that you will need to code the entire console then.

Arne
Oct 18 '07 #4
There is a way to pass values to the console window and return the response.
I used it once to get the return of a ping command. I'll post it if I find
the code. In the meanwhile have a look at this:
http://www.geekpedia.com/tutorial230...API-Calls.html -
I believe it's similar to what you've already done, but worth checking out.

"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:47***********************@news.sunsite.dk...
ScottH wrote:
>Yeah I got the console to show up that way. It comes up as a separate
window from my forms. I wanted to embed it in a form, any idea how to
do that?

I am afraid that you will need to code the entire console then.

Arne
Oct 18 '07 #5
I found it and posted it:
http://www.geekpedia.com/code42_Pass...nd-Prompt.html

Hope it helps.

"Andrew P." <an**********@geekpedia.comwrote in message
news:OK**************@TK2MSFTNGP04.phx.gbl...
There is a way to pass values to the console window and return the
response. I used it once to get the return of a ping command. I'll post it
if I find the code. In the meanwhile have a look at this:
http://www.geekpedia.com/tutorial230...API-Calls.html -
I believe it's similar to what you've already done, but worth checking
out.

"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:47***********************@news.sunsite.dk...
>ScottH wrote:
>>Yeah I got the console to show up that way. It comes up as a separate
window from my forms. I wanted to embed it in a form, any idea how to
do that?

I am afraid that you will need to code the entire console then.

Arne
Oct 18 '07 #6
ScottH wrote:
Curious how you could embed a console in a Windows form.. any ideas ?
I made a tool that could either be pure command line or be windowed
depending on the arguments. If no arguments was supplied it was a
windowed interface. It also displayed a console. I just made a console
application and added windows to it like following.

[STAThread]
static void Main(string[] args)
{
if (args.Length == 0)
{
interactive = new Form1();
Application.Run(interactive);
}
else
DoCommandLine(args);
}

Hope this helps
Leon Lambert
Oct 18 '07 #7
thanks for all the response everyone :-)

On Oct 18, 6:49 am, Leon Lambert <lambe...@inil.comwrote:
ScottH wrote:
Curious how you could embed a console in a Windows form.. any ideas ?

I made a tool that could either be pure command line or be windowed
depending on the arguments. If no arguments was supplied it was a
windowed interface. It also displayed a console. I just made a console
application and added windows to it like following.

[STAThread]
static void Main(string[] args)
{
if (args.Length == 0)
{
interactive = new Form1();
Application.Run(interactive);
}
else
DoCommandLine(args);

}

Hope this helps
Leon Lambert

Oct 18 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jason Callas | last post: by
11 posts views Thread by objectref | last post: by
reply views Thread by Russell Mangel | last post: by
reply views Thread by Mythran | last post: by
2 posts views Thread by stevie.greenslade | last post: by
7 posts views Thread by Abelard | last post: by
10 posts views Thread by Stephany Young | last post: by
3 posts views Thread by =?Utf-8?B?VGVycmFuY2U=?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.