你可以选择使用这个函数#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <Crypt.au3>
#include <WinAPI.au3>
; 实例 实时 RC4 加密
$hWnd=GUICreate("数据加密",400,300,-1)
$hInputEdit=GUICtrlCreateEdit("",0,0,400,150,$ES_WANTRETURN)
$hOutputEdit=GUICtrlCreateEdit("",0,150,400,150,$ES_READONLY)
GUIRegisterMsg($WM_COMMAND,"WM_COMMAND")
GUISetState(@SW_SHOW)
; 为优化性能启动程序库及创建密钥
_Crypt_Startup()
$hKey=_Crypt_DeriveKey("SomePassword",$CALG_RC4)
Do
$msg=GUIGetMsg()
Until $msg=$GUI_EVENT_close
_Crypt_DestroyKey($hKey)
_Crypt_Shutdown()
Func WM_COMMAND($hWinHandle,$iMsg,$wParam,$lParam)
; 如果输入编辑框中有改动
If _WinAPI_HiWord($wParam)=$EN_CHANGE And _WINAPI_LoWord($wParam)=$hInputEdit Then
$bEncrypted=_Crypt_EncryptData(GUICtrlRead($hInputEdit),$hKey,$CALG_USERKEY)
GUICtrlSetData($hOutputEdit,$bEncrypted)
EndIf
EndFunc
|