本帖最后由 chishingchan 于 2014-10-21 17:29 编辑
此程序的作用是对比安装版软件的文件与达人发布的程序压缩包对比文件的不同。
我的原意是名称占用左侧大部分空间,大小及CRC32靠窗口右侧,请问如何处理?
名称大小CRC32.au3#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Local $sDir = FileSelectFolder("选择一个文件夹.", "")
GUICreate($sDir,640,480,100,200,-1,$WS_EX_ACCEPTFILES)
$listview = GUICtrlCreateListView("名称|大小|CRC32",0,0,640,480)
FindAllFile($sDir)
Func FindAllFile($sDir)
Local $hSearch = FileFindFirstFile($sDir & "\*.*")
If $hSearch = -1 Then Return
While 1
Local $sFile = FileFindNextFile($hSearch)
If @error Then ExitLoop
If @extended Then
FindAllFile($sDir & "" & $sFile)
ContinueLoop
EndIf
$BufferSize = 0x20000
Global $sCRC32 = 0
For $i = 1 To Ceiling(FileGetSize($sDir & "" & $sFile)/$BufferSize)
$sCRC32 = _CRC32(FileRead(FileOpen($sDir & "" & $sFile,16),$BufferSize),BitNot($sCRC32))
Next
GUICtrlCreateListViewItem($sDir & "" & $sFile & "|" & FileGetSize($sDir & "" & $sFile) & "|" & Hex($sCRC32,8), $listview)
WEnd
FileClose($hSearch)
EndFunc
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUISetState()
Do
$msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE
Func _CRC32($Data, $CRC32 = -1)
Local $Opcode = '0xC800040053BA2083B8EDB9000100008D41FF516A0859D1E8730231D0E2F85989848DFCFBFFFFE2E78B5D088B4D0C8B451085DB7416E3148A1330C20FB6D2C1E80833849500FCFFFF43E2ECF7D05BC9C21000'
Local $CodeBuffer = DllStructCreate("byte[" & BinaryLen($Opcode) & "]")
DllStructSetData($CodeBuffer, 1, $Opcode)
Local $Input = DllStructCreate("byte[" & BinaryLen($Data) & "]")
DllStructSetData($Input, 1, $Data)
Local $Ret = DllCall("user32.dll", "uint", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), _
"ptr", DllStructGetPtr($Input), _
"int", BinaryLen($Data), _
"uint", $CRC32, _
"int", 0)
$Input = 0
$CodeBuffer = 0
Return $Ret[0]
EndFunc
|