Progress bar cannot be shown while a process is running

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kimiraikkonen

    #1

    Progress bar cannot be shown while a process is running

    Hi there,
    There is a problem about progress bar; although the
    "progressbar1.v isible = True" is present for my invisible
    "progressba r1" control to make visible when button1 is clicked, before
    execution of my external process, it appears after the external
    process finishes processing. And my main and only form (form1) cannot
    be interacted while external process is processing. How can i get rid
    of it?

    Here is the code:

    Private Sub Button1_Click_1 (ByVal sender As System.Object, ByVal e As
    System.EventArg s) Handles Button1.Click

    progressbar1.vi sible = True

    Dim psInfo As New System.Diagnost ics.ProcessStar tInfo("c:\blabl a.exe)
    psInfo.WindowSt yle = System.Diagnost ics.ProcessWind owStyle.Normal
    Dim myProcess As Process = System.Diagnost ics.Process.Sta rt(psInfo)
    myProcess.WaitF orExit()
    MsgBox(" Completed Successfully", MsgBoxStyle.Inf ormation,
    "Completed" )

    End Sub


    Thanks and regards...

  • kimiraikkonen

    #2
    Re: Progress bar cannot be shown while a process is running

    Also, note: blabla.exe costs %100 CPU during processing. Could it be
    the reason?

    Anyway i tried with %40-50 cpu-costing external application with
    similar negative result. While external process is running, the main
    VB form is corrupted and distorted visually, as appearence and you
    cannot click or modify main form during external process runs.

    Comment

    • Cor Ligthert[MVP]

      #3
      Re: Progress bar cannot be shown while a process is running

      Armin,

      Nice explanation and even without the so by me damned words "message pump".

      :-)

      Cor

      Comment

      • Armin Zingler

        #4
        Re: Progress bar cannot be shown while a process is running

        "Cor Ligthert[MVP]" <notmyfirstname @planet.nlschri eb
        Armin,
        >
        Nice explanation
        Thanks :)
        and even without the so by me damned words "message
        pump".
        I'll put it in my synonym list. ;)


        Armin

        Comment

        • kimiraikkonen

          #5
          Re: Progress bar cannot be shown while a process is running

          On Oct 4, 2:17 pm, "Armin Zingler" <az.nos...@free net.dewrote:
          "Cor Ligthert[MVP]" <notmyfirstn... @planet.nlschri eb
          >
          Armin,
          >
          Nice explanation
          >
          Thanks :)
          >
          and even without the so by me damned words "message
          pump".
          >
          I'll put it in my synonym list. ;)
          >
          Armin
          Mr. Zingler,
          Thank you for your detailed answer.

          Comment

          • kimiraikkonen

            #6
            Re: Progress bar cannot be shown while a process is running

            Also, if i remove waitforexit(), main form can be interacted while the
            external process is running without coding mutlithreading. So is the
            unique way to set multi-threading to use waitforexit() effect and main
            form interaction at the same same time with external process?

            Comment

            • Armin Zingler

              #7
              Re: Progress bar cannot be shown while a process is running

              "kimiraikko nen" <kimiraikkonen8 5@gmail.comschr ieb
              Also, if i remove waitforexit(), main form can be interacted while
              the external process is running without coding mutlithreading.
              Right
              So is
              the unique way to set multi-threading to use waitforexit() effect
              and main form interaction at the same same time with external
              process?
              Sorry, I don't understand. If you want to wait for exit, you either can
              handle the process' Exited event or you can call waitforexit in another
              thread. For this purpose I'd prefer handling the Exit event.


              Armin


              Comment

              • kimiraikkonen

                #8
                Re: Progress bar cannot be shown while a process is running

                On Oct 5, 12:52 pm, "Armin Zingler" <az.nos...@free net.dewrote:
                "kimiraikko nen" <kimiraikkone.. .@gmail.comschr ieb
                >
                Also, if i remove waitforexit(), main form can be interacted while
                the external process is running without coding mutlithreading.
                >
                Right
                >
                So is
                the unique way to set multi-threading to use waitforexit() effect
                and main form interaction at the same same time with external
                process?
                >
                Sorry, I don't understand. If you want to wait for exit, you either can
                handle the process' Exited event or you can call waitforexit in another
                thread. For this purpose I'd prefer handling the Exit event.
                >
                Armin
                Thanks Armin, so could you give a simple example about handle exit
                event? Sorry for being newbie and glad to receive help from experts.

                Thanks.

                Comment

                • Armin Zingler

                  #9
                  Re: Progress bar cannot be shown while a process is running

                  "kimiraikko nen" <kimiraikkonen8 5@gmail.comschr ieb
                  Thanks Armin, so could you give a simple example about handle exit
                  event? Sorry for being newbie and glad to receive help from experts.

                  Dim p As Process
                  '...
                  'start process
                  '...
                  AddHandler p.Exited, AddressOf OnProcessExited



                  Private Sub OnProcessExited ( _
                  ByVal sender As Object, ByVal e As System.EventArg s)

                  MsgBox("exited" )

                  End Sub


                  Armin

                  Comment

                  • kimiraikkonen

                    #10
                    Re: Progress bar cannot be shown while a process is running

                    On Oct 5, 11:01 pm, "Armin Zingler" <az.nos...@free net.dewrote:
                    "kimiraikko nen" <kimiraikkone.. .@gmail.comschr ieb
                    >
                    Thanks Armin, so could you give a simple example about handle exit
                    event? Sorry for being newbie and glad to receive help from experts.
                    >
                    Dim p As Process
                    '...
                    'start process
                    '...
                    AddHandler p.Exited, AddressOf OnProcessExited
                    >
                    Private Sub OnProcessExited ( _
                    ByVal sender As Object, ByVal e As System.EventArg s)
                    >
                    MsgBox("exited" )
                    >
                    End Sub
                    >
                    Armin
                    Thanks but sorry, "OnProcessExite d" cannot be found via intellisense.
                    I'm using vb.net 2005 express.

                    Comment

                    • Armin Zingler

                      #11
                      Re: Progress bar cannot be shown while a process is running

                      "kimiraikko nen" <kimiraikkonen8 5@gmail.comschr ieb
                      On Oct 5, 11:01 pm, "Armin Zingler" <az.nos...@free net.dewrote:
                      "kimiraikko nen" <kimiraikkone.. .@gmail.comschr ieb
                      Thanks Armin, so could you give a simple example about handle
                      exit event? Sorry for being newbie and glad to receive help from
                      experts.
                      Dim p As Process
                      '...
                      'start process
                      '...
                      AddHandler p.Exited, AddressOf OnProcessExited

                      Private Sub OnProcessExited ( _
                      ByVal sender As Object, ByVal e As System.EventArg s)

                      MsgBox("exited" )

                      End Sub

                      Armin
                      >
                      Thanks but sorry, "OnProcessExite d" cannot be found via
                      intellisense. I'm using vb.net 2005 express.
                      >
                      ?? It's right there below.


                      Armin

                      Comment

                      • kimiraikkonen

                        #12
                        Re: Progress bar cannot be shown while a process is running

                        On Oct 6, 5:50 pm, "Armin Zingler" <az.nos...@free net.dewrote:
                        "kimiraikko nen" <kimiraikkone.. .@gmail.comschr ieb
                        >
                        >
                        >
                        >
                        >
                        On Oct 5, 11:01 pm, "Armin Zingler" <az.nos...@free net.dewrote:
                        "kimiraikko nen" <kimiraikkone.. .@gmail.comschr ieb
                        >
                        Thanks Armin, so could you give a simple example about handle
                        exit event? Sorry for being newbie and glad to receive help from
                        experts.
                        >
                        Dim p As Process
                        '...
                        'start process
                        '...
                        AddHandler p.Exited, AddressOf OnProcessExited
                        >
                        Private Sub OnProcessExited ( _
                        ByVal sender As Object, ByVal e As System.EventArg s)
                        >
                        MsgBox("exited" )
                        >
                        End Sub
                        >
                        Armin
                        >
                        Thanks but sorry, "OnProcessExite d" cannot be found via
                        intellisense. I'm using vb.net 2005 express.
                        >
                        ?? It's right there below.
                        >
                        Armin- Hide quoted text -
                        >
                        - Show quoted text -
                        There are a lot of intellisense listed OnXXXXX statements but there's
                        no "OnProcessExite d" beleive. :(

                        Comment

                        • Jack Jackson

                          #13
                          Re: Progress bar cannot be shown while a process is running

                          On Sat, 06 Oct 2007 08:47:08 -0700, kimiraikkonen
                          <kimiraikkonen8 5@gmail.comwrot e:
                          >On Oct 6, 5:50 pm, "Armin Zingler" <az.nos...@free net.dewrote:
                          >"kimiraikkonen " <kimiraikkone.. .@gmail.comschr ieb
                          >>
                          >>
                          >>
                          >>
                          >>
                          On Oct 5, 11:01 pm, "Armin Zingler" <az.nos...@free net.dewrote:
                          "kimiraikko nen" <kimiraikkone.. .@gmail.comschr ieb
                          >>
                          Thanks Armin, so could you give a simple example about handle
                          exit event? Sorry for being newbie and glad to receive help from
                          experts.
                          >>
                          Dim p As Process
                          '...
                          'start process
                          '...
                          AddHandler p.Exited, AddressOf OnProcessExited
                          >>
                          Private Sub OnProcessExited ( _
                          ByVal sender As Object, ByVal e As System.EventArg s)
                          >>
                          MsgBox("exited" )
                          >>
                          End Sub
                          >>
                          Armin
                          >>
                          Thanks but sorry, "OnProcessExite d" cannot be found via
                          intellisense. I'm using vb.net 2005 express.
                          >>
                          >?? It's right there below.
                          >>
                          >Armin- Hide quoted text -
                          >>
                          >- Show quoted text -
                          >
                          >There are a lot of intellisense listed OnXXXXX statements but there's
                          >no "OnProcessExite d" beleive. :(
                          Look at the code Armin posted. OnProcessExited is defined in that
                          code.

                          Comment

                          Working...