本帖最后由 dnvplj 于 2012-9-22 02:21 编辑
下面的代码是弹出光驱+卸载U盘,请问各位朋友:“进度条”如何从开始到结束都显示。;1退出光驱
Dim $var=DriveGetDrive("CDROM")
CDTray($var[1],"open")
TrayTip("通知","光驱已弹出,稍后自动关闭!",1)
Sleep(5000)
CDTray($var[1],"closed")
;2退出U盘
Run("Rundll32 Shell32.dll,Control_RunDLL HotPlug.dll",@SystemDir);调用对话框
WinWait("安全删除硬件","硬件设备(&H):")
WinActivate("安全删除硬件","硬件设备(&H):")
Send("!S")
WinWait("停用硬件设备","确认被停止的设备")
WinActivate("停用硬件设备","确认被停止的设备")
ControlClick("停用硬件设备","确认被停止的设备","Button1")
WinWait("安全删除硬件","关闭(&C)")
WinActivate("安全删除硬件","关闭(&C)")
ControlClick("安全删除硬件","关闭(&C)","Button3")
ProgressOn("程序正在卸载U盘", "10秒将关闭程序", "0 %")
For $i = 10 to 100 step 10
sleep(1000)
ProgressSet( $i, $i & " %")
Next
ProgressSet(100 , "完成", "卸载U盘成功,请把出U盘")
sleep(500)
ProgressOff()
Exit
;3进度条
ProgressOn("程序正在卸载U盘", "10秒将关闭程序", "0 %")
For $i = 10 to 100 step 10
sleep(1000)
ProgressSet( $i, $i & " %")
Next
ProgressSet(100 , "完成", "卸载U盘成功,请把出U盘")
sleep(500)
ProgressOff()
Exit
|