473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

I wanna implement the revolving slash while the process is executing

I have a Windows console application, which takes around 3 minutes to
complete the execution.

I am interested in implementing something animate while users are
waiting for the process to complete.

If you have experience with Linux/Unix, you should be very familiar
with the revolving slash ( / ) or the growing dots ( ...... ), which
you normally see, when a process is taking some time.

I guess I may have to implement 2 threads. One does the real dirty
work behind, the other displays the revolving slashes (maybe it is a
combination of --, / and \) or grows the dots.

Any idea how to implement this fun stuff? Thanks.

Jul 27 '07 #1
5 2324
if your doing gui i would do somthing Graphical
else
back in the old dos days i did the used the \ / -

based on what ur doing....a process bar is a nice thing
if you can calculate the time...or size for units
otherwise when the calculations are not possible

a disabled text box colord as the window is ..can be used also filling it
and scrolling it with dots....

i used 1 progressbar and filled it one way and reversed it the other way and
forward and back....til lthe process was finished

send 1 thread off to do the work
and main or new 2 thread to work the progress bar...

there's some ideas
MJ
<an***********@yahoo.comwrote in message
news:11**********************@22g2000hsm.googlegro ups.com...
>I have a Windows console application, which takes around 3 minutes to
complete the execution.

I am interested in implementing something animate while users are
waiting for the process to complete.

If you have experience with Linux/Unix, you should be very familiar
with the revolving slash ( / ) or the growing dots ( ...... ), which
you normally see, when a process is taking some time.

I guess I may have to implement 2 threads. One does the real dirty
work behind, the other displays the revolving slashes (maybe it is a
combination of --, / and \) or grows the dots.

Any idea how to implement this fun stuff? Thanks.

Jul 27 '07 #2
"MikeJ" <ve***********@sbcglobal.netwrote in message
news:ek*******************@newssvr21.news.prodigy. net...
if your doing gui
OP begins, "I have a Windows console application"...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 27 '07 #3
an***********@yahoo.com wrote:
I have a Windows console application, which takes around 3 minutes to
complete the execution.

I am interested in implementing something animate while users are
waiting for the process to complete.

If you have experience with Linux/Unix, you should be very familiar
with the revolving slash ( / ) or the growing dots ( ...... ), which
you normally see, when a process is taking some time.

I guess I may have to implement 2 threads. One does the real dirty
work behind, the other displays the revolving slashes (maybe it is a
combination of --, / and \) or grows the dots.

Any idea how to implement this fun stuff? Thanks.
How fancy do you want?

Here's a simple example:

static void Main()
{
Thread thread = new Thread(ThreadStart(DoWork));
char[] rgchBusy = new char[] { '-', '\', '|', '/' };
int ichBusy = 0;

thread.Start();

// The thread that does the work will set WorkDoneWaitHandle,
// an instance of a WaitHandle, when it's done.
while (WorkDoneWaitHandle.WaitOne(1000))
{
Console.WriteLine("\r" + rgchBusy[ichBusy]);
ichBusy = (ichBusy + 1) % rgchBusy.Length;
}
}
Jul 28 '07 #4
On Jul 27, 8:10 pm, Peter Duniho <NpOeStPe...@NnOwSlPiAnMk.comwrote:
antonyliu2...@yahoo.com wrote:
I have a Windows console application, which takes around 3 minutes to
complete the execution.
I am interested in implementing something animate while users are
waiting for the process to complete.
If you have experience with Linux/Unix, you should be very familiar
with therevolvingslash( / ) or the growing dots ( ...... ), which
you normally see, when a process is taking some time.
I guess I may have to implement 2 threads. One does the real dirty
work behind, the other displays therevolvingslashes (maybe it is a
combination of --, / and \) or grows the dots.
Any idea how to implement this fun stuff? Thanks.

How fancy do you want?

Here's a simple example:

static void Main()
{
Thread thread = new Thread(ThreadStart(DoWork));
char[] rgchBusy = new char[] { '-', '\', '|', '/' };
int ichBusy = 0;

thread.Start();

// The thread that does the work will set WorkDoneWaitHandle,
// an instance of a WaitHandle, when it's done.
while (WorkDoneWaitHandle.WaitOne(1000))
{
Console.WriteLine("\r" + rgchBusy[ichBusy]);
ichBusy = (ichBusy + 1) % rgchBusy.Length;
}
}

Thanks. I tried your trick. It works. I was using the backspace
character \b, which did not help. The \r absolutely helped.

How about the growing dots (......)?

Of course, simply growing the dots is easy, but I am not sure how to
remove all those dots and then start growing from scratch on the same
line again. Could anyone of you shed some light on this? Thanks.

Jul 30 '07 #5
an***********@yahoo.com wrote:
Thanks. I tried your trick. It works. I was using the backspace
character \b, which did not help. The \r absolutely helped.

How about the growing dots (......)?

Of course, simply growing the dots is easy, but I am not sure how to
remove all those dots and then start growing from scratch on the same
line again. Could anyone of you shed some light on this? Thanks.
It would be pretty much the same as the "spinning line", except that
rather than writing the \r character each time, you'd only write it when
you'd written as many periods as make up the line you want (presuambly,
no more than there are characters wide on your console :) ).

Pete
Jul 30 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Xaradas | last post by:
Someone could tell me why preg_replace eat a slash when it do replacement? <? $stringToReplace = "blah blah {nome} blah blah"; $replacement = "Two slash: \\\\"; $stringToReplace =...
23
by: Hostile17 | last post by:
I keep coming across people, online and in real life, who believe that to code single tags like <br> and <img> with trailing slashes, <br /> and <img /> is considered "best practice" and when...
6
by: benz | last post by:
I am trying to fork and exec a child by python. Additionally, I am attempting to have a spinning slash while the child is running. My code is as below: import sys, os, time def...
4
by: Prince Kumar | last post by:
I joined a company recently and they have a java program which hangs (does nothing) after a while. This is no way consistent. It could succeed quite a few times and can fail a few other times....
12
by: Raymond Lewallen | last post by:
How to wait for a process to stop completion is my goal. Obviously, the looping while waiting for the HasExited property is not a solution.. but thats the best I can come up off the top of my...
15
by: jcrouse | last post by:
Here is my code: Dim sw As StreamWriter = File.CreateText(Application.StartupPath & "\mameversion.bat") sw.WriteLine(lblMameExePath.Text & " -help >""" & Application.StartupPath &...
0
by: BasicQ | last post by:
I am running an executable from my aspx page with the click of a button. A date is passed as an argument. I am able to get the standardoutput from the Process(Exe) into the label of my page after...
10
by: Michele Simionato | last post by:
I have always been curious about how people implement mainloops (or, in Twisted terminology, reactors). So I sit down and I wrote the following simple implementation: import itertools class...
3
by: somuchh8 | last post by:
Hi, I'm having a lot of trouble with the Win32::Spawn module in perl. Here is my situation, I have a Win32::Spawn call which looks like this: my $success = undef; my $cmdline =...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.