#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ComboConstants.au3>
#include <StringConstants.au3>
#include <Crypt.au3>
#include <WinAPI.au3>
Global $g_iAlgorithm = $CALG_SHA1, $g_idInputEdit = -1, $g_idOutputEdit = -1
$Form1 = GUICreate("Form1", 441, 333)
$ButtonGui2Open = GUICtrlCreateButton("ButtonGui2Open", 112, 152, 201, 41)
$ButtonCryptGuiOpen = GUICtrlCreateButton("ButtonCryptGuiOpen", 112, 200, 201, 41)
$Input1 = GUICtrlCreateInput("", 104, 32, 225, 21)
$Input2 = GUICtrlCreateInput("", 104, 64, 225, 21)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ButtonCryptGuiOpen
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
_Form3()
GUIRegisterMsg($WM_COMMAND, "")
Case $ButtonGui2Open
_Form2()
EndSwitch
WEnd
Func _Form2()
GUISetState(@SW_DISABLE, $Form1)
$aMetagGui = GUICreate("Form2", 706, 350, -1, -1, -1, -1, $Form1)
$Input1 = GUICtrlCreateInput("", 16, 64, 169, 21)
GUICtrlSendMsg($Input1, $EM_SETCUEBANNER, False, "sample asdf.")
$Input2 = GUICtrlCreateInput("", 16, 131, 169, 21) ;
GUICtrlSendMsg($Input2, $EM_SETCUEBANNER, False, "samle asdf.")
$Label1 = GUICtrlCreateLabel("(Title)", 16, 40, 84, 17)
$Label2 = GUICtrlCreateLabel("(Description)", 16, 107, 145, 17)
GUISetState(@SW_SHOW, $aMetagGui)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUISetState(@SW_ENABLE, $Form1)
GUIDelete($aMetagGui)
ExitLoop
EndSwitch
WEnd
EndFunc ;==>_Form2
Func _Form3()
GUISetState(@SW_DISABLE, $Form1)
Local $aForm3 = GUICreate("Form3", 550, 320, -1, -1, -1, -1, $Form1)
$g_idInputEdit = GUICtrlCreateEdit("", 0, 0, 550, 150, $ES_WANTRETURN)
$g_idOutputEdit = GUICtrlCreateEdit("", 0, 150, 550, 150, $ES_READONLY)
Local $idCombo = GUICtrlCreateCombo("", 0, 300, 100, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData($idCombo, "MD2|MD4|MD5|SHA1", "SHA1")
GUISetState(@SW_SHOW, $aForm3)
_Crypt_Startup()
Local $dHash = 0, _
$sRead = ""
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUISetState(@SW_ENABLE, $Form1)
GUIDelete($aForm3)
_Crypt_Shutdown()
ExitLoop
Case $idCombo
Switch GUICtrlRead($idCombo)
Case "MD2"
$g_iAlgorithm = $CALG_MD2
Case "MD4"
$g_iAlgorithm = $CALG_MD4
Case "MD5"
$g_iAlgorithm = $CALG_MD5
Case "SHA1"
$g_iAlgorithm = $CALG_SHA1
EndSwitch
$sRead = GUICtrlRead($g_idInputEdit)
If StringStripWS($sRead, $STR_STRIPALL) <> "" Then
$dHash = _Crypt_HashData($sRead, $g_iAlgorithm)
GUICtrlSetData($g_idOutputEdit, StringTrimLeft($dHash, 2))
EndIf
EndSwitch
WEnd
EndFunc ;==>_Form3
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
#forceref $hWnd, $iMsg, $lParam
Switch _WinAPI_LoWord($wParam)
Case $g_idInputEdit
Switch _WinAPI_HiWord($wParam)
Case $EN_CHANGE
Local $dHash = _Crypt_HashData(GUICtrlRead($g_idInputEdit), $g_iAlgorithm)
GUICtrlSetData($g_idOutputEdit, StringTrimLeft($dHash, 2))
EndSwitch
EndSwitch
EndFunc ;==>WM_COMMAND