|
本帖最后由 cfeng 于 2010-11-20 09:37 编辑
问题已解决原因设计不对
[img][/img]
AU3做的7Z自解压打包工具
我的解压进度条解压文件的时侯进度条是进一小段停下卡哪不动,等一下就百分之百完成[文件大小是200MB左右],后面的进度都看不见,我想让进度条均匀连续显示该怎么写,谢谢
有人说是7-zip32.dll这个文件的关系,我换了几个是一样,说明下本人不太会au3,就上来问问了.下面是源文件:
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#Region
#EndRegion
If Not FileExists(@SystemDir & "\7-zip32.dll") Then FileInstall("7-zip32.dll", @SystemDir & "\", 1)
#include <7Zip.au3>
Global $HideINI = _READCONFIG(@ScriptFullPath)
Global $Title = _IniRead($HideINI, "你们看不到我", "窗口标题", "")
Global $Path = _IniRead($HideINI, "你们看不到我", "解压路径", "")
Global $Runex = _IniRead($HideINI, "你们看不到我", "执行程序", "")
Global $lnkName = _IniRead($HideINI, "你们看不到我", "快捷方式", "")
Global $lnkExe = _IniRead($HideINI, "你们看不到我", "指向文件", "")
Global $Quiet = _IniRead($HideINI, "你们看不到我", "安静解压", "")
Global $Auto = _IniRead($HideINI, "你们看不到我", "自动解压", "")
#cs
MsgBox(0,"",$Title)
MsgBox(0,"",$Path)
MsgBox(0,"",$Runex)
MsgBox(0,"",$lnkName)
MsgBox(0,"",$lnkExe)
MsgBox(0,"",$Quiet)
MsgBox(0,"",$Auto)
#ce
If $Quiet = 1 Then
_7ZIPExtractEx(0, @ScriptFullPath, $Path, 1)
ADDlnk()
Runex()
Exit
EndIf
FileInstall("SkinCrafterDll.dll", @TempDir & "\SkinCrafterDll.dll", 1)
FileInstall("vista_style.skf", @TempDir & "\vista_style.skf", 1)
FileInstall("Logo.jpg", @TempDir & "\Logo.jpg", 1)
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $dll, $Progress
$hGUI = GUICreate($Title, 414, 105)
_SkinGUI(@TempDir & "\SkinCrafterDll.dll", @TempDir & "\vista_style.skf", $hGUI)
$Pic = GUICtrlCreatePic(@TempDir & "\Logo.jpg", 0, 0, 414, 76)
$Input = GUICtrlCreateInput("", 5, 80, 310, 20)
$But1 = GUICtrlCreateButton("...", 320, 80, 25, 20)
$But2 = GUICtrlCreateButton("解压", 350, 80, 60, 20)
GUICtrlSetData($Input, $Path)
GUISetState(@SW_SHOW)
If $Auto = 1 Then Extract()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_SkinQUIT()
Exit
Case $But1
$Folder = FileSelectFolder("", "", "", "", $hGUI)
If Not @error Then GUICtrlSetData($Input, $Folder)
Case $But2
$Path = GUICtrlRead($Input)
Extract()
EndSwitch
WEnd
Func Extract()
GUICtrlDelete($Input)
GUICtrlDelete($But1)
GUICtrlDelete($But2)
$Progress = GUICtrlCreateProgress(0, 80, 414, 20)
$retResult = _7ZipSetOwnerWindowEx($hGUI, "_ARCHIVERPROC")
If $retResult = 0 Then
MsgBox(4096 + 16, "", " 不可思议的错误!", -1, $hGUI)
Return ""
EndIf
$retResult = _7ZIPExtractEx($hGUI, @ScriptFullPath, $Path, 1)
If $retResult = 0 Then
MsgBox(4096 + 16, "", " 不可思议的错误!", -1, $hGUI)
Return ""
EndIf
_SkinQUIT()
ADDlnk()
Runex()
Exit
EndFunc ;==>Extract
Func ADDlnk()
If $lnkName <> "" And $lnkExe <> "" Then
If FileExists($Path & "\" & $lnkExe) Then
FileCreateShortcut($Path & "\" & $lnkExe, @DesktopDir & "\" & $lnkName & ".lnk")
ElseIf FileExists($lnkExe) Then
FileCreateShortcut($lnkExe, @DesktopDir & "\" & $lnkName & ".lnk")
EndIf
EndIf
EndFunc ;==>ADDlnk
Func Runex()
If $Runex <> "" Then
If FileExists($Path & "\" & $Runex) Then
Run($Path & "\" & $Runex)
ElseIf FileExists($Runex) Then
Run($Runex)
EndIf
EndIf
EndFunc ;==>Runex
Func _ARCHIVERPROC($hWnd, $Msg, $nState, $ExInfo)
Local $iFileSize, $iWriteSize, $iPercent = 0
If $nState = 0 Then
Local $EXTRACTINGINFO = DllStructCreate($tagEXTRACTINGINFO, $ExInfo)
;GUICtrlSetData($Edit, DllStructGetData($EXTRACTINGINFO, "szSourceFileName") & @CRLF, 1) ;当前释放的文件
$iFileSize = DllStructGetData($EXTRACTINGINFO, "dwFileSize")
$iWriteSize = DllStructGetData($EXTRACTINGINFO, "dwWriteSize")
$iPercent = Int($iWriteSize / $iFileSize * 100)
GUICtrlSetData($Progress, $iPercent)
WinSetTitle($hGUI, "", $Title & " " & $iPercent & "%")
Return 1
EndIf
If $nState = 2 Then GUICtrlSetData($Progress, 130)
Return 1
EndFunc ;==>_ARCHIVERPROC
Func _SkinGUI($SkincrafterDll, $SkincrafterSkin, $Handle)
$dll = DllOpen($SkincrafterDll)
DllCall($dll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "1@1.com", "wstr", "1")
DllCall($dll, "int:cdecl", "InitDecoration", "int", 1)
DllCall($dll, "int:cdecl", "LoadSkinFromFile", "wstr", $SkincrafterSkin)
DllCall($dll, "int:cdecl", "DecorateAs", "int", $Handle, "int", 25)
DllCall($dll, "int:cdecl", "ApplySkin")
EndFunc ;==>_SkinGUI
Func _SkinQUIT()
GUISetState(@SW_HIDE)
DllCall($dll, "int:cdecl", "DeInitDecoration")
DllCall($dll, "int:cdecl", "RemoveSkin")
DllClose($dll)
FileDelete(@TempDir & "\Logo.jpg")
FileDelete(@TempDir & "\vista_style.skf")
FileDelete(@TempDir & "\SkinCrafterDll.dll")
EndFunc ;==>_SkinQUIT
Func _READCONFIG($file)
Local $MaxSize = 2000000
Local $FileSize = FileGetSize($file)
If $FileSize < $MaxSize Then $MaxSize = $FileSize
$FH1 = FileOpen($file, 0)
$Text = FileRead($FH1, $MaxSize)
$Text_S = StringInStr($Text, "AU3!EA06;!QQ162108338@!UTF-8!")
If $Text_S = 0 Then
FileClose($FH1)
Return ""
Else
$Text_E = StringInStr($Text, ";!QQ162108338End@!")
If $Text_E = 0 Then
FileClose($FH1)
Return ""
EndIf
FileClose($FH1)
$config = StringMid($Text, $Text_S + 30, $Text_E - $Text_S - 32)
Return $config
EndIf
EndFunc ;==>_READCONFIG
Func _IniRead($iFile, $Section, $key, $default = '', $mode = 0)
Local $s_Sec = _IniReadSection_str($iFile, $Section, $mode)
If @error = 1 Then Return SetError(1, 0, $default)
If @error = 2 Then Return SetError(3, 0, $default)
Local $_key = StringRegExpReplace($key, '^\h*(.+?)\h*$', '$1')
$_key = StringRegExpReplace($_key, '(\.|\||\*|\?|\+|\(|\)|\{|\}|\[|\]|\^|\$|\\|\=)', '\\$1')
Local $Val = StringRegExp(@LF & $s_Sec & @LF, '\n\h*(?i)(' & $_key & ')\h*\=\h*([^\r\n]*?)\h*[\r\n]', 3)
If @error Then Return SetError(2, 0, $default)
Return $Val[1]
EndFunc ;==>_IniRead
Func _IniReadSection_str($s_File, $Section, $mode = 0, $nFlag = 0)
If $s_File = "" Then Return SetError(1, 0, 0)
Local $line_all
Local $_Section = StringRegExpReplace($Section, '^\h*(.+?)\h*$', '$1')
$_Section = StringRegExpReplace($_Section, '(\.|\||\*|\?|\+|\(|\)|\{|\}|\[|\]|\^|\$|\\)', '\\$1')
$_Section = '\[\h*' & $_Section & '\h*\]'
Local $s_Sec = StringRegExp($s_File, '(?s)(?i)(?:^|\n)\h*' & $_Section & '(.+?)(?=\r?\n\h*\[|$)', 3)
If @error Then Return SetError(1, 0, 0)
$line_all = $s_Sec[0]
If $nFlag Then
For $i = 1 To UBound($s_Sec) - 1
$line_all &= $s_Sec[$i]
Next
EndIf
If Not StringRegExp($line_all, '[^\s]') Then Return SetError(2, 0, 0)
Return $line_all
EndFunc ;==>_IniReadSection_str |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入
×
|