Dear All
I thank you for everyone who helped for the this post.
And now my aim that how to display a progress bar for the shelled process.For example i am shelling viewer.exe with the file of 1.htm. How can I.
Printable View
Dear All
I thank you for everyone who helped for the this post.
And now my aim that how to display a progress bar for the shelled process.For example i am shelling viewer.exe with the file of 1.htm. How can I.
Doing a real progress bar would require the shelled program to somehow be able to return it's progress to your program; in this case what you're requesting is impossible (or for the least very hard to do without further knowledge of internals of the shelled program). However, you could do a progress bar that doesn't really show anything else than that a progress is going on. I guess you've sometime seen a progress bar that has about 100 pixels wide "bar" that loops from left to right, bar coming in from the left and going out of the right, until everything is done?
Edit!
A poor man's sample: add Picture1, Label1 into Picture1 and a Timer1 to a new project. Paste this code:VB Code:
Option Explicit Private Sub Form_Load() Picture1.ScaleMode = vbPixels Picture1.BackColor = vbHighlightText Label1.BackColor = vbHighlight Label1.Caption = vbNullString Label1.Move -100, 0, 100, Picture1.ScaleHeight Timer1.Interval = 1 End Sub Private Sub Timer1_Timer() If Label1.Left <= Picture1.ScaleWidth Then Label1.Left = Label1.Left + 5 Else Label1.Left = -100 End If End Sub
Dear Merri,
Thanks for your post.This exe will open the html file in ie or some browser.Is it posible to get the estimated time and display a progress bar.
The only way to estimate the time with any accuracy is to run it once and time it, then use that time for your progressbar when you open it again... obviously not a great solution as it will take twice as long (and will have other issues, like the app being open twice).
The only decent way to do it is not have a progressbar, but some kind of "working" message/graphic as Merri suggested.
Progress bars are only valid when you have a known time, or a known number of steps.
Dear si,
The File size will vary from time to time.For this kind of situation it will be a tedious one.
For html files, the size of the file is not the biggest factor in how long it will take to load - the complexity is (eg: the table layout/formatting/...), which is hard to determine (and will take time).
So, once again, a 'percent complete' or time-based progressbar is not valid.
Something like Merri posted is by far the best option.
Try this - it'll show that something's happening.lblTimer is a label that's about 1 character wide and 1 character high, with Alignment set to 2 - Center. The timer should be set for an interval of about 100.VB Code:
Private Sub Timer1_Timer() Static i As Integer Select Case i Case 0 lblTimer.Caption = "/" i = 1 Case 1 lblTimer.Caption = "-" i = 2 Case 2 lblTimer.Caption = "\" i = 3 Case 3 lblTimer.Caption = "|" i = 4 Case 4 lblTimer.Caption = "/" i = 5 Case 5 lblTimer.Caption = "-" i = 6 Case 6 lblTimer.Caption = "\" i = 7 Case 7 lblTimer.Caption = "|" i = 0 End Select End Sub