Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / May 2004

Tip: Looking for answers? Try searching our database.

Console Applications question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alexandre Gomes - 13 May 2004 01:08 GMT
I've been searching for a clue for this but can't find one.

Is possible to create an aplication with something like:

"Decompressing... x%"

Where the x will be changing with the evolution of the decompression in
this case.
In this case I used decompressing but it could be anything like in Linux
 or Dos where u can have an application in textmode.

Thanks
William Stacey [MVP] - 13 May 2004 01:15 GMT
Sure, you just need to fiddle with it a little.
Console.Write("Decompressing...\r");

while(true)
{
  Console.Write("Decompressing...{0}%\r", var);
}

Note the carrage return but no line feed.  You could also do this with
backspace(s) if you wish.
I did something similar with color in the MSH shell beta in a cmdlet.

This works if you don't munge your display with other output.  Another idea
is to update the Titlebar instead with your status info and reset the bar
back to original when done.

Signature

William Stacey, MVP

> I've been searching for a clue for this but can't find one.
>
[quoted text clipped - 8 lines]
>
> Thanks
Alexandre Gomes - 13 May 2004 01:35 GMT
> Sure, you just need to fiddle with it a little.
> Console.Write("Decompressing...\r");
[quoted text clipped - 11 lines]
> is to update the Titlebar instead with your status info and reset the bar
> back to original when done.

Thanks for your tips, that helps.
If I need to use more than 1 line I can just fill the end of my line
with white spaces. Yet, that can be a mess because I do not know the
screen/window chars with. Any clue on this one? Also how can I put
colors in there? (What is MSH Shell?)
William Stacey [MVP] - 13 May 2004 05:06 GMT
> If I need to use more than 1 line I can just fill the end of my line
> with white spaces. Yet, that can be a mess because I do not know the
> screen/window chars with.

Not sure I understand your need.

> Also how can I put colors in there? (What is MSH Shell?)
Win32 pinvoke or look for xConsole library on google or WinConsole:
http://www.codeproject.com/csharp/winconsole.asp?target=Console%7CEnhancements

LH will have color console support, but that is down the road.

Signature

William Stacey, MVP

Andrew Baum - 13 May 2004 01:28 GMT
Here is an example.

if(loop conditions)
{
string tmp = String.Format("Decompressing: {0}%",<percent>);
Console.Write(tmp);
Console.Write("".PadLeft(tmp.Length,(char)8));
}

-Andrew

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.