Results 1 to 7 of 7

Thread: Progress bar for the shelled process

  1. #1

    Thread Starter
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Progress bar for the shelled process

    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.

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Progress bar for the shelled process

    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:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.     Picture1.ScaleMode = vbPixels
    5.     Picture1.BackColor = vbHighlightText
    6.     Label1.BackColor = vbHighlight
    7.     Label1.Caption = vbNullString
    8.     Label1.Move -100, 0, 100, Picture1.ScaleHeight
    9.     Timer1.Interval = 1
    10. End Sub
    11.  
    12. Private Sub Timer1_Timer()
    13.     If Label1.Left <= Picture1.ScaleWidth Then
    14.         Label1.Left = Label1.Left + 5
    15.     Else
    16.         Label1.Left = -100
    17.     End If
    18. End Sub
    Last edited by Merri; Aug 26th, 2006 at 03:41 AM.

  3. #3

    Thread Starter
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Progress bar for the shelled process

    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.

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Progress bar for the shelled process

    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.

  5. #5

    Thread Starter
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Progress bar for the shelled process

    Dear si,
    The File size will vary from time to time.For this kind of situation it will be a tedious one.

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Progress bar for the shelled process

    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.

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Progress bar for the shelled process

    Try this - it'll show that something's happening.
    VB Code:
    1. Private Sub Timer1_Timer()
    2. Static i As Integer
    3.  
    4.   Select Case i
    5.     Case 0
    6.       lblTimer.Caption = "/"
    7.       i = 1
    8.     Case 1
    9.       lblTimer.Caption = "-"
    10.       i = 2
    11.     Case 2
    12.       lblTimer.Caption = "\"
    13.       i = 3
    14.     Case 3
    15.       lblTimer.Caption = "|"
    16.       i = 4
    17.     Case 4
    18.       lblTimer.Caption = "/"
    19.       i = 5
    20.     Case 5
    21.       lblTimer.Caption = "-"
    22.       i = 6
    23.     Case 6
    24.       lblTimer.Caption = "\"
    25.       i = 7
    26.     Case 7
    27.       lblTimer.Caption = "|"
    28.       i = 0
    29.   End Select
    30.  
    31. End Sub
    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.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width