11月22014
Hex值十六进制字符串逐行转换
因写别的程序的需求
用于更新数据
需要配套一个这种小玩具
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#Region ### START Koda GUI section ### Form=D:\永昌20140814\加解密更新\Form1.kxf
$Form1_1 = GUICreate("Hex 转换(逐行) by:绿色风 blog:www.JianYiIT.com", 581, 548, 292, 124)
$Edit1 = GUICtrlCreateEdit("", 2, 0, 576, 250, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetData(-1, "Hex值十六进制字符串 逐行转换")
$Edit2 = GUICtrlCreateEdit("", 2, 293, 576, 250, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetData(-1, "")
$Button1 = GUICtrlCreateButton("Hex 转换", 54, 256, 80, 33)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("Hex 还原", 148, 256, 80, 33)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("↑↓", 250, 256, 80, 33)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Button4 = GUICtrlCreateButton("复制↓",351, 256, 80, 33)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button7 = GUICtrlCreateButton("↑粘贴", 449, 256, 80, 33)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1 ;HEX 转换
Local $arr = StringSplit(GUICtrlRead($Edit1), @CRLF, 1)
If IsArray($arr) = 1 Then
Local $str = ""
For $i = 1 To $arr[0]
$str &= _StringToHex($arr[$i]) & @CRLF
Next
GUICtrlSetData($Edit2, $str)
EndIf
_sFlash()
Case $Button2 ;HEX 还原
Local $arr = StringSplit(GUICtrlRead($Edit1), @CRLF, 1)
If IsArray($arr) = 1 Then
Local $str = ""
For $i = 1 To $arr[0]
$str &= _HexToString($arr[$i]) & @CRLF
Next
GUICtrlSetData($Edit2, $str)
EndIf
_sFlash()
Case $Button3 ;↑↓ 上下调换
Local $E1 = GUICtrlRead($Edit1)
Local $E2 = GUICtrlRead($Edit2)
GUICtrlSetData($Edit1, $E2)
GUICtrlSetData($Edit2, $E1)
_sFlash2()
Case $Button4 ;复制↓ 下
Local $E2 = GUICtrlRead($Edit2)
ClipPut($E2)
_sFlash()
Case $Button7 ;↑粘贴 上
GUICtrlSetData($Edit1, ClipGet())
_sFlash()
EndSwitch
WEnd
;对控件上的文本闪烁一下
Func _sFlash($hw = $nMsg)
GUICtrlSetColor($hw, 0x0000FF)
Sleep(150)
GUICtrlSetColor($hw, 0x000000)
Sleep(150)
GUICtrlSetColor($hw, 0x0000FF)
Sleep(150)
GUICtrlSetColor($hw, 0x000000)
EndFunc ;==>_sFlash
Func _sFlash2($hw = $nMsg)
GUICtrlSetColor($hw, 0x000000)
Sleep(150)
GUICtrlSetColor($hw, 0x0000FF)
Sleep(150)
GUICtrlSetColor($hw, 0x000000)
Sleep(150)
GUICtrlSetColor($hw, 0x0000FF)
EndFunc ;==>_sFlash2```
扫描二维码,在手机上阅读

