|
本帖最后由 cls822001 于 2010-1-28 18:09 编辑
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include "ACN_HASH.au3"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("MD5验证器", 293, 136, 386, 255, -1, $WS_EX_ACCEPTFILES)
$Label1 = GUICtrlCreateLabel("把您要验证的文件拖到下面区域", 40, 24, 200, 18)
GUICtrlSetFont(-1, 11, 400, 0, "新宋体")
$edit=GUICtrlCreateEdit("",30, 48, 228, 80)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_DROPPED
$File = GUICtrlRead($edit)
$md5 = add()
GUICtrlSetData($edit, $md5)
EndSwitch
WEnd
Func add()
$BufferSize = 0x20000
$Filename = $File
MsgBox(0, "", $Filename);这里得到的不是3呀是EDIT里输入的,可不知道为什么最后得到的非是EDIT的控件ID
If $Filename = "" Then Exit
$FileHandle = FileOpen($Filename, 16)
$MD5CTX = _MD5Init()
For $i = 1 To Ceiling(FileGetSize($Filename) / $BufferSize)
_MD5Input($MD5CTX, FileRead($FileHandle, $BufferSize))
Next
$Hash = _MD5Result($MD5CTX)
FileClose($FileHandle)
Return SetError(0, 0, Hex($Hash))
EndFunc ;==>add |
|