积极答复者
进度条一冲就过去了,但进程还过了一段时间才停止的

问题
-
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
进度条一冲就过去了,但进程还过了一段时间才停止的。
答案
-
进度条本来就是个假的,你不知道什么时候结束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月19日 0:27
全部回复
-
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/ -
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到底该如何设置呢? -
进度条本来就是个假的,你不知道什么时候结束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月19日 0:27
-
经测试发觉 lExit每次都是259,最后为0,
看样子我用ProgressBar1.Max = &H103
不太正确,ProgressBar1.Max到底该如何设置呢?
进度条本来就是个假的,你不知道什么时候结束
http://feiyun0112.cnblogs.com/
确实,压缩一个1G的和压缩一个一兆的,等待的时间都不同,所以无法设置ProgressBar1.Max的值