none
进度条一冲就过去了,但进程还过了一段时间才停止的 RRS feed

  • 问题

  • Public Sub ShellWait(sCommandLine As String)           
          Dim hShell     As Long, hProc As Long, lExit As Long
     
           hShell = Shell(sCommandLine, vbHide)
         
          hProc = OpenProcess(&H400, False, hShell)
          ProgressBar1.Min = 0
          ProgressBar1.Max = &H103
          Do
              GetExitCodeProcess hProc, lExit
              ProgressBar1.Value = lExit
              DoEvents
          Loop While lExit = &H103
          MsgBox ("完成压缩")
          ProgressBar1.Value = 0
         
    End Sub


    进度条一冲就过去了,但进程还过了一段时间才停止的。

    2009年6月18日 5:11

答案

  • Public Sub ShellWait(sCommandLine As String)           
          Dim hShell     As Long, hProc As Long, lExit As Long
     
           hShell = Shell(sCommandLine, vbHide)
         
          hProc = OpenProcess(&H400, False, hShell)
          ProgressBar1.Min = 0
          ProgressBar1.Max = &H103
    ProgressBar1.Value = 0
          Do
              GetExitCodeProcess hProc, lExit
    if ProgressBar1.Value <  ProgressBar1.Max  then  ProgressBar1.Value =ProgressBar1.Value+1
              DoEvents
          Loop While lExit = &H103
          MsgBox ("完成压缩")
          ProgressBar1.Value = 0
         
    End Sub


    http://feiyun0112.cnblogs.com/

    经测试发觉 lExit每次都是259,最后为0,
    看样子我用ProgressBar1.Max = &H103
    不太正确,ProgressBar1.Max到底该如何设置呢?
    进度条本来就是个假的,你不知道什么时候结束
    http://feiyun0112.cnblogs.com/
    2009年6月18日 5:59
    版主

全部回复

  • Public Sub ShellWait(sCommandLine As String)           
          Dim hShell     As Long, hProc As Long, lExit As Long
     
           hShell = Shell(sCommandLine, vbHide)
         
          hProc = OpenProcess(&H400, False, hShell)
          ProgressBar1.Min = 0
          ProgressBar1.Max = &H103
    ProgressBar1.Value = 0
          Do
              GetExitCodeProcess hProc, lExit
    if ProgressBar1.Value <  ProgressBar1.Max  then  ProgressBar1.Value =ProgressBar1.Value+1
              DoEvents
          Loop While lExit = &H103
          MsgBox ("完成压缩")
          ProgressBar1.Value = 0
         
    End Sub


    http://feiyun0112.cnblogs.com/
    2009年6月18日 5:24
    版主
  • Public Sub ShellWait(sCommandLine As String)           
          Dim hShell     As Long, hProc As Long, lExit As Long
     
           hShell = Shell(sCommandLine, vbHide)
         
          hProc = OpenProcess(&H400, False, hShell)
          ProgressBar1.Min = 0
          ProgressBar1.Max = &H103
    ProgressBar1.Value = 0
          Do
              GetExitCodeProcess hProc, lExit
    if ProgressBar1.Value <  ProgressBar1.Max  then  ProgressBar1.Value =ProgressBar1.Value+1
              DoEvents
          Loop While lExit = &H103
          MsgBox ("完成压缩")
          ProgressBar1.Value = 0
         
    End Sub


    http://feiyun0112.cnblogs.com/

    经测试发觉 lExit每次都是259,最后为0,
    看样子我用ProgressBar1.Max = &H103
    不太正确,ProgressBar1.Max到底该如何设置呢?
    2009年6月18日 5:44
  • Public Sub ShellWait(sCommandLine As String)           
          Dim hShell     As Long, hProc As Long, lExit As Long
     
           hShell = Shell(sCommandLine, vbHide)
         
          hProc = OpenProcess(&H400, False, hShell)
          ProgressBar1.Min = 0
          ProgressBar1.Max = &H103
    ProgressBar1.Value = 0
          Do
              GetExitCodeProcess hProc, lExit
    if ProgressBar1.Value <  ProgressBar1.Max  then  ProgressBar1.Value =ProgressBar1.Value+1
              DoEvents
          Loop While lExit = &H103
          MsgBox ("完成压缩")
          ProgressBar1.Value = 0
         
    End Sub


    http://feiyun0112.cnblogs.com/

    经测试发觉 lExit每次都是259,最后为0,
    看样子我用ProgressBar1.Max = &H103
    不太正确,ProgressBar1.Max到底该如何设置呢?
    进度条本来就是个假的,你不知道什么时候结束
    http://feiyun0112.cnblogs.com/
    2009年6月18日 5:59
    版主

  • 经测试发觉 lExit每次都是259,最后为0,
    看样子我用ProgressBar1.Max = &H103
    不太正确,ProgressBar1.Max到底该如何设置呢?



    进度条本来就是个假的,你不知道什么时候结束
    http://feiyun0112.cnblogs.com/

    确实,压缩一个1G的和压缩一个一兆的,等待的时间都不同,所以无法设置ProgressBar1.Max的值
    2009年6月18日 6:20