progress bar

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • moley_cruz@yahoo.com.au

    #1

    progress bar

    Hi,
    If i start a process using System.Diagnost ics.Process.Sta rt(myprog.exe,

    myattributes)
    is it possible to display a running process bar instead of showing a
    DOS window which shows what the program is doing?
    thanks

  • Chris

    #2
    Re: progress bar

    moley_cruz@yaho o.com.au wrote:[color=blue]
    > Hi,
    > If i start a process using System.Diagnost ics.Process.Sta rt(myprog.exe,
    >
    > myattributes)
    > is it possible to display a running process bar instead of showing a
    > DOS window which shows what the program is doing?
    > thanks
    >[/color]

    You can use the ProcessInfo class to start the process with no window.
    Don't know if that will do what you want.

    Chris

    Comment

    • Steven Nagy

      #3
      Re: progress bar

      Why don't you just run your progress bar in a seperate thread, instead
      of a seperate process?
      I think it would be safer that way (main program exits, so does
      progress bar).
      Also, you won't get a dos window (although use the Process Background
      property to hide the dos prompt).

      With a progress bar, you want to be able to call the STEP method to
      make sure it actually increases as your program performs tasks.
      This is a lot harder in another process (which is basically another
      application) as opposed to another thread (same application).

      Here's a simple example:

      Dim frmProgress as new ProgressForm()
      me.hide()
      frmProgress.Sho w()

      ' do stuff
      frmProgress.Pro gressBar.Step()

      ' do more stuff
      frmProgress.Pro gressBar.Step()

      ' hack Microsoft site
      frmProgress.Pro gressBar.Step()

      ' take over the world
      frmProgress.Pro gressBar.Step()

      frmProgress.Clo se()
      me.Show()


      Steven Nagy

      Comment

      • Lynn

        #4
        Re: progress bar

        Hi Steven,
        thanks for your reply but i do not understand what you mean.
        I am a vb.net newbie

        Comment

        • Cor Ligthert [MVP]

          #5
          Re: progress bar

          Lynn,

          You don't have control of the process that is running in the DosBox.
          Therefore the steps of the progressbar can not be measured. A progressbar
          needs a begin, an end and the steps to reach that. You have only the begin.

          I hope this gives an idea

          Cor

          "Lynn" <moley_cruz@yah oo.com.au> schreef in bericht
          news:1142250377 .469111.27630@p 10g2000cwp.goog legroups.com...[color=blue]
          > Hi Steven,
          > thanks for your reply but i do not understand what you mean.
          > I am a vb.net newbie
          >[/color]


          Comment

          • Steven Nagy

            #6
            Re: progress bar

            What part don't you understand?
            What is your final objective here? Perhaps give more of a rundown of
            what you are trying to achieve.

            Steve

            Comment

            • Lynn

              #7
              Re: progress bar

              i need to run a batch file from my windows form. Instead of displaying
              what i am running to the user, i want to hide the DOS window and
              replace it with a progress bar to tell me that the batch file is still
              running. Not sure if this is possible.

              Comment

              • Cor Ligthert [MVP]

                #8
                Re: progress bar

                Lynn,

                That is in my opinion not possible. What is mostly done (as well by
                Microsoft) is showing an AVI until the waitforexit is done.

                http://msdn.microsoft.com/library/de...exittopic2.asp


                Those AVI's are in Visual Studio Net somewhere in the program files (it can
                be that you first have to unpack the zip file with those)

                I hope this helps,

                Cor.





                Comment

                • Lynn

                  #9
                  Re: progress bar

                  if i use WaitForExit my windows form hangs with a white foreground
                  until the DOS command has finished executing.
                  is this normal? can this be overcome?

                  Comment

                  • Lynn

                    #10
                    Re: progress bar

                    Cor,
                    can you also post a sample code on how showing an AVI is used with
                    waitforexit?
                    thanks

                    Comment

                    • Cor Ligthert [MVP]

                      #11
                      Re: progress bar

                      Lynn,

                      I have not the time to make a sample now however in pseudo code (almost
                      real).

                      Open a new project
                      Drag on that an picturebox
                      Set the image to a *gif* file.
                      You can find those in gif animations in
                      C:\Program Files\Microsoft Visual Studio 8\Common7\VS200 5ImageLibrary

                      set the picturebox to visible = false

                      picturebox1.vis ible = true

                      Dim p As New System.Diagnost ics.ProcessStar tInfo()
                      p.Verb = "print"
                      p.CreateNoWindo w = True
                      p.WindowStyle = ProcessWindowSt yle.Hidden
                      p.FileName = "C:\filename.ex e"
                      Dim pr As System.Diagnost ics.Process = System.Diagnost ics.Process.Sta rt(p)
                      pr.WaitForExit( )

                      picturebox1.vis ible = false

                      I hope this helps,

                      Cor


                      Comment

                      • Steven Nagy

                        #12
                        Re: progress bar

                        Run the 'wait for exit' in a seperate thread. Have it raise an event
                        when done.
                        Have you main form catch the event and hide the pic box.

                        SN

                        Comment

                        • Cor Ligthert [MVP]

                          #13
                          Re: progress bar

                          Steven,
                          [color=blue]
                          > Run the 'wait for exit' in a seperate thread. Have it raise an event[/color]

                          Why a seperate thread to run a Gif? The Dos process itself is already in a
                          seperated process.

                          Cor


                          Comment

                          • Steven Nagy

                            #14
                            Re: progress bar

                            Its not the dos process that is the issue.
                            Its the main UI thread being told to wait for exit.
                            Which means I won't spend any time on redrawing your screen while its
                            waiting, thus the whiteness you mentioned.

                            Comment

                            • Lynn

                              #15
                              Re: progress bar

                              can you post a sample code on this -> 'wait for exit' in a seperate
                              thread. Have it raise an event when done.
                              thanks in advance

                              Comment

                              Working...