Click here to Skip to main content
13,093,406 members (81,730 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I have a question i can't seem to find an answer to, and i hope someone can help :)
I want to create a application similar to Yakuake, Tilda, etc.

Currently i have been able to achive something simelar to this by using a textbox to enter the commands and another textbox to display the results using streams, but thats not a real shell now is it.

Console2([^]) does pretty much what I want to acheive, but not 100%.

So is there anyone here that know what technique that have been used in Console2? (And similar programs?) Another program that does this is the Powershell ISE, it's divided in 3 sections with a interactive powershell-shell at the bottom(So it should be do-able to do this in other programs aswell, right?)

Anyways, I hope someone here are able to put me in the right direction :)

Posted 21-Feb-12 11:29am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This is a well-known thing, which is implemented in the class System.Management.Automation.PowerShell, please see:[^].

You can find a simple code sample here:[^].

Now, this sample uses a default console as it comes in console applications. You can use console in your Forms applications; you can show no output; or you can show output in some System.Windows.Forms control. I would recommend using ListBox to have the look closest to the traditional console. You can present the work of the shell in any other way.

If the execution of the shell can take some noticeable time, you should run it all in a separate thread. If you need to present some data produced by this PowerShell thread, you will need to use UI thread invocation, which I described in detail in my past solutions:
Control.Invoke() vs. Control.BeginInvoke()[^],
Problem with Treeview Scanner And MD5[^].

See also more references to my past answers on threading:
How to get a keydown event to operate on a different thread in[^],
Control events not firing after enable disable + multithreading[^].

ProEnggSoft 21-Feb-12 18:48pm
Good Info. Hence Voted 5.
SAKryukov 21-Feb-12 20:47pm
Thank you.
Karl-Einarb 22-Feb-12 4:46am
Thank you very much for the answer! :)
I haven't been able to test it yet, but the listbox idéa was a good one.
SAKryukov 22-Feb-12 11:59am
You are very welcome.
It works, for sure.

Good luck, call again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 21 Feb 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100