Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a Progress bar

Status
Not open for further replies.

hugh999

MIS
Nov 29, 2001
129
0
0
IE
Hi

I have a small program that when you clik on a specific command button, it executes a batch file on my computer. The batch file takes about 10 minutes to complete, so i am trying to add a progress bar to the program that indicates the progress of the batch file and when it has finished running.
I have been reading the other threads regarding "Progress bars", but not having much luck as i am a beginer to VB

This is the type of code i am using to call the batch file.

Private Sub Command1_Click()
Dim Temp As Single
Temp = Shell("c:\Builder\builder.bat", vbMinimizedFocus)
End Sub

Any help or code would be appreciated

Thanks
Hugh
 
Hi,

As far as i am aware there is no way to do this.

The Shell command runs the command asynchronously and returns the process id. (Async means that the process will run simulateously to other processes).

As a cheap solution you could write a vb app that emulates the process given that you can test if it is running in a loop.

At work we have a similar progress bar that never actually reaches 100%. Instead it starts of quick and exponentially gets slower whilst it is running.

Another solution, one which i would prefer, would be to add echo commands to the script itself indicating to the user of certain points of progress.

for example :

@echo off
echo "Stage 1: Copying files."
xcopy c:\Src C:\src\bak
echo "Stage 2: Purging."
del /s *.EXE


Hope this helps.

Richard.



 
this depend on the kind of commands you include in batch file,maybe if you give us an idea about this commands we can help you better
 
Hi

The commands in the batch file will delete certin files from my computer and then go to a Visual source safe database and get a number of files and drop them to certin locations on my computer.

If a progress bar is not the ideal solution, is their code i could insert in to my VB program that knows when the batch file has completed and then display a msgbox informing me of this.

Thanks
 
Aha - now we are moving into the territory of ShellAndWait. Just do a keyword search in this forum on "Shell Wait" or "ShellAndWait" for the last 6 months and you should find a number of solutions.
 
Thanks for the help.

I found what i was looking for.

Cheers
Hugh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top