AutoIt: 3.3.0.0
Версия: 1.0.0.1
Категория: Математика
Описание: Бит Калькулятор, выплолняющий операции с BitAND, BitOR, BitXOR.
Запись чисел для вычисления в DEC и HEX формате.
Вывод результата в DEC и HEX формате.
Программа является продолжением темы - BitOR - (побитовое логическое сложение) GUI интерфейс, т.к. это совершенно новая программа об изменениях я не пишу.
Используемые библиотеки: Resources.au3
Файл: AU3: EXE
Код:
Screenshot:
Для компиляции заполняем папку Utilities соответствующими программами:
http://www.autoitscript.com/autoit3/scite/download - http://www.autoitscript.com/autoit3/scite/download/AutoIt3Wrapper.exe
http://bogdan.at.ua/reshack/index.html - http://bogdan.at.ua/reshack/reshack.zip
http://upx.sourceforge.net/#download - http://upx.sourceforge.net/download/upx304w.zip
Кое что конечно не получилось, просьба поправить.
1. Фильтр для ввода только HEX чисел
2. Остальное я сам поправлю как будет время :whistle:
Версия: 1.0.0.1
Категория: Математика
Описание: Бит Калькулятор, выплолняющий операции с BitAND, BitOR, BitXOR.
Запись чисел для вычисления в DEC и HEX формате.
Вывод результата в DEC и HEX формате.
Программа является продолжением темы - BitOR - (побитовое логическое сложение) GUI интерфейс, т.к. это совершенно новая программа об изменениях я не пишу.
Используемые библиотеки: Resources.au3
Файл: AU3: EXE
Код:
Код:
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=Output\Bit_Calculator.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=© 2009 FlatX007. Все права защищены. Эта программа является бесплатной и может использоваться и распространяться свободно, но только при условии, что содержимое этого архива не изменено в любом виде, и его содержимое не повреждено. Автор не несет никакой ответственности за убытки, которые могут возникнуть с использованием этого программного обеспечения.
#AutoIt3Wrapper_Res_Description=Bit Calculator © 2010 FlatX007
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_LegalCopyright=FlatX007
#AutoIt3Wrapper_Res_Language=1049
#AutoIt3Wrapper_Res_Field=Исходное Имя Файла|Bit_Calculator.exe
#AutoIt3Wrapper_Res_Field=Дата Сборки|%date% %time%
#AutoIt3Wrapper_Res_Field=Версия AutoIT|%AutoItVer%
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -delete %out%, %out%, DIALOG, 1000,
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -delete %out%, %out%, ICON, 162,
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -delete %out%, %out%, ICON, 164,
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -delete %out%, %out%, MENU, 166,
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -delete %out%, %out%, ICON, 169,
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\Copyright.txt, rcdata, COPYRIGHT, 0
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\LangRUS.txt, rcdata, LANG_RUS, 0
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\Background.jpg, rcdata, BACKGROUND, 0
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\LogoTop.jpg, rcdata, LOGO_TOP, 0
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\Logo_About.png, rcdata, LOGO_ABOUT, 0
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\Arrow_Left.png, rcdata, ARROW_LEFT, 0
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\Arrow_Right.png, rcdata, ARROW_RIGHT, 0
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\Null.ico, Icon, 0, 0
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\Ico.ico, Icon, 1, 1 ; ICO
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\DEC.ico, Icon, 2, 2 ;DEC
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\HEX.ico, Icon, 3, 3 ;HEX
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\AND.ico, Icon, 4, 4 ; AND
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\OR.ico, Icon, 5, 5 ; OR
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\XOR.ico, Icon, 6, 6 ; XOR
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\Ok.ico, Icon, 7, 7
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\Clear.ico, Icon, 8, 8
#AutoIt3Wrapper_Run_After=Utilities\ResHacker\ResHacker.exe -add %out%, %out%, Res\Click.wav, sound, CLICK, 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiComboBoxEx.au3>
#include <GuiEdit.au3>
#include <GuiImageList.au3>
#include <GuiButton.au3>
#include <WinAPI.au3>
#include <Utilities\Resources.au3>
Dim $aMeasurement[2] = ["DEC", "НЕХ"]
Dim $aAction[3] = ["BitAND", "BitOR", "BitXOR"]
Dim $aRerturnSimbolHEX[10] = [1, 2, 3, 4, 5, 6, 7, 8, "Авто", "Авто + 0"]
Dim $ahInput[6]
Dim $ahCombo[4]
Dim $ahButton[2]
Dim $aKey[4] = ["Measurement", "Action", "Enter", "RerturnSimbolHEX"]
Dim $aReadInput[5]
Dim $sSirtingContrl[5]
Dim $aFontName[2][2] = [ _
["DS Crystal", "cristal.TTF"], _
["Micra", "Mic_____.ttf"]]
Const $NAME_PROGRAM = 'Bit calculator'
Const $VERSION_PROGRAM = 'v1.0.0.1'
Const $REG_PATH = 'HKEY_CURRENT_USER\Software\' & $NAME_PROGRAM
Const $sPATH_FONTS_DIR_WINDOWS = @WindowsDir & '\Fonts'
Const $LANG_RUS = 'LANG_RUS'
Const $LANG_ENG = 'LANG_ENG'
Global $sOld_Opt_GRM = Opt("GUIResizeMode", $GUI_DOCKALL)
Global $iGUI_Width = 218
Global $iGUI_Height = 430
$iColorDec = 0xFF8000
$iColorNEX = 0x0000FF
$iBkColorDisable = 0x858585
$iBkColorEnable = 0xF0F0F0
_ProtectRepeatedStart()
$aTEXT_CONTRl = _Lang($LANG_RUS)
$hGUI = GUICreate($NAME_PROGRAM, $iGUI_Width, $iGUI_Height)
GUISetIcon(@ScriptFullPath, 0)
RegWrite($REG_PATH, "WinGetHandle", "REG_SZ", WinGetHandle($hGUI, ""))
$Pic1 = GUICtrlCreatePic("", 0, 0, 482, 63)
_ResourceSetImageToCtrl(-1, "LOGO_TOP")
GUICtrlSetState(-1, $GUI_DISABLE)
$Pic2 = GUICtrlCreatePic("", 0, 64, 468, 430)
_ResourceSetImageToCtrl(-1, "BACKGROUND")
GUICtrlSetState(-1, $GUI_DISABLE)
$Pic4 = GUICtrlCreatePic("", 165, 67, 40, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$ahInput[0] = GUICtrlCreateInput("", 24, 96, 169, 27, $WS_BORDER)
GUICtrlSetFont(-1, 14, 600, 0, $aFontName[0][0])
GUICtrlSetBkColor(-1, 0xF0F0F0)
$ahInput[1] = GUICtrlCreateInput("", 24, 132, 169, 27, BitOR($ES_AUTOHSCROLL, $WS_BORDER))
GUICtrlSetFont(-1, 14, 600, 0, $aFontName[0][0])
GUICtrlSetBkColor(-1, 0xF0F0F0)
$ahInput[2] = GUICtrlCreateInput("", 24, 169, 169, 27, BitOR($ES_AUTOHSCROLL, $WS_BORDER))
GUICtrlSetFont(-1, 14, 600, 0, $aFontName[0][0])
GUICtrlSetBkColor(-1, 0xF0F0F0)
$ahInput[3] = GUICtrlCreateInput("", 24, 206, 169, 27, BitOR($ES_AUTOHSCROLL, $WS_BORDER))
GUICtrlSetFont(-1, 14, 600, 0, $aFontName[0][0])
GUICtrlSetBkColor(-1, 0xF0F0F0)
$ahInput[4] = GUICtrlCreateInput("", 24, 242, 169, 27, BitOR($ES_AUTOHSCROLL, $WS_BORDER))
GUICtrlSetFont(-1, 14, 600, 0, $aFontName[0][0])
GUICtrlSetBkColor(-1, 0xF0F0F0)
$ahInput[5] = GUICtrlCreateInput($aTEXT_CONTRl[5], 24, 336, 169, 28, BitOR($ES_AUTOHSCROLL, $WS_BORDER, $ES_READONLY))
GUICtrlSetFont(-1, 14, 600, 0, $aFontName[0][0])
GUICtrlSetBkColor(-1, 0xF0F0F0)
$ahCombo[0] = _GUICtrlComboBoxEx_Create($hGUI, "", 25, 288, 81, 100, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $CBS_SORT))
$ahCombo[1] = _GUICtrlComboBoxEx_Create($hGUI, "", 112, 288, 81, 100, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $CBS_SORT))
$ahCombo[2] = _GUICtrlComboBoxEx_Create($hGUI, "", 25, 368, 81, 100, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $CBS_SORT))
$ahCombo[3] = _GUICtrlComboBoxEx_Create($hGUI, "", 112, 368, 81, 150, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $CBS_SORT))
$ahButton[0] = GUICtrlCreateButton($aTEXT_CONTRl[3], 25, 400, 81, 25)
GUICtrlSetTip(-1, $aTEXT_CONTRl[1])
_ImageListButton($ahButton[0], 7)
$ahButton[1] = GUICtrlCreateButton($aTEXT_CONTRl[4], 112, 400, 81, 25, $BS_DEFPUSHBUTTON)
GUICtrlSetTip(-1, $aTEXT_CONTRl[2])
_ImageListButton($ahButton[1], 6)
GUICtrlCreateGroup("", 17, 83, 184, 234)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", 16, 323, 184, 74)
GUICtrlCreateGroup("", -99, -99, 1, 1)
#Region -----------------------------------------------------------------------------------------------------------------------
$Edit1 = GUICtrlCreateEdit("", 240, 240, 217, 161, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_READONLY, $ES_WANTRETURN)) ; $ES_CENTER
$sCopyright = _ResourceGetAsString("COPYRIGHT")
_GUICtrlEdit_AppendText($Edit1, $sCopyright & @CRLF)
GUICtrlSetFont(-1, 7, 600, 0, $aFontName[1][0])
$Pic3 = GUICtrlCreatePic("", 288, 90, 100, 100)
_ResourceSetImageToCtrl(-1, "LOGO_ABOUT")
GUICtrlSetState(-1, $GUI_DISABLE)
$Label2 = GUICtrlCreateLabel("", 240, 200, 215, 25, $SS_CENTER)
GUICtrlSetData(-1, $NAME_PROGRAM & ' ' & $VERSION_PROGRAM)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(-1, 9, 800, 0, $aFontName[1][0])
#EndRegion -----------------------------------------------------------------------------------------------------------------------
_AddRegCopyright()
_InstallFonts()
_ComboBoxAddString()
_ImageListComboBox($ahCombo[0])
_ImageListComboBox($ahCombo[1])
_ImageListComboBox($ahCombo[2])
_ComboBoxReadSettings()
_SetFunc()
_Toggle_ExpandControls_Proc($hGUI, $iGUI_Width, $iGUI_Width + 250, $Pic4, "ARROW_RIGHT", "ARROW_LEFT")
_Toggle_ExpandControls_Proc($hGUI, $iGUI_Width, $iGUI_Width + 250, $Pic4, "ARROW_RIGHT", "ARROW_LEFT")
;~ _WinAPICreateRectRgn_Round()
Opt("GUIResizeMode", $sOld_Opt_GRM)
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_Sound_Play(True, "CLICK", False)
_ExitScript()
Case $ahButton[0]
_Sound_Play(True, "CLICK", False)
_FieldsGUIInputDEC_NEX()
Case $ahButton[1]
_Sound_Play(True, "CLICK", False)
_TotalCalculationOutput()
Case $Pic4
_Sound_Play(True, "CLICK", False)
;~ _WinAPICreateRectRgn_Default()
_Toggle_ExpandControls_Proc($hGUI, $iGUI_Width, $iGUI_Width + 250, $Pic4, "ARROW_RIGHT", "ARROW_LEFT")
;~ _WinAPICreateRectRgn_Round()
EndSwitch
WEnd
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
$iIDFrom = BitAND($iwParam, 0xFFFF)
$iCode = BitShift($iwParam, 16)
Local $aRead[2] = [GUICtrlRead($iIDFrom), GUICtrlRead($iIDFrom, 1)]
For $i = 1 To $aTEXT_CONTRl[0]
If $aTEXT_CONTRl[$i] = $aRead[1] Then ExitLoop
_FilterEntering()
_BitAND_GUIInputEnableDisable()
Next
Switch $ilParam
Case $ahCombo[0], $ahCombo[1], $ahCombo[2], $ahCombo[3]
If $iCode = $CBN_SELCHANGE Then _SetFunc()
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND
Func _FilterEntering()
Switch _GUICtrlComboBoxEx_GetCurSel($ahCombo[0])
Case 0 ; DEC
For $i = 0 To UBound($ahInput) - 2
If StringIsDigit(GUICtrlRead($ahInput[$i])) = 0 Then GUICtrlSetData($ahInput[$i], StringTrimRight(GUICtrlRead($ahInput[$i]), 1))
Next
Case 1 ; NEX
;~ For $i = 0 To UBound($ahInput) - 2
;~ If StringLen(GUICtrlRead($ahInput[$i])) > 2 And StringIsDigit(StringMid(GUICtrlRead($ahInput[$i]), 3)) = 0 Then GUICtrlSetData($ahInput[$i], "0x" & StringTrimRight(GUICtrlRead($ahInput[$i]), 1), "")
;~ Next
EndSwitch
EndFunc ;==>_FilterEntering
Func _ComboBoxAddString()
For $i = 0 To UBound($aMeasurement) - 1
_GUICtrlComboBoxEx_AddString($ahCombo[0], $aMeasurement[$i], $i, $i)
_GUICtrlComboBoxEx_AddString($ahCombo[2], $aMeasurement[$i], $i, $i)
Next
For $i = 0 To UBound($aAction) - 1
_GUICtrlComboBoxEx_AddString($ahCombo[1], $aAction[$i], _GUICtrlComboBoxEx_GetCount($ahCombo[0]) + $i, _GUICtrlComboBoxEx_GetCount($ahCombo[0]) + $i)
Next
For $i = 0 To UBound($aRerturnSimbolHEX) - 1
_GUICtrlComboBoxEx_AddString($ahCombo[3], $aRerturnSimbolHEX[$i])
Next
EndFunc ;==>_ComboBoxAddString
Func _ComboBoxReadSettings()
If RegRead($REG_PATH, "Measurement") = "" Or RegRead($REG_PATH, "Action") = "" Or RegRead($REG_PATH, "Enter") = "" Or RegRead($REG_PATH, "RerturnSimbolHEX") = "" Then
For $i = 0 To UBound($aKey) - 1
_GUICtrlComboBoxEx_SetCurSel($ahCombo[$i], 0)
If $i = 3 Then _GUICtrlComboBoxEx_SetCurSel($ahCombo[$i], 9)
Next
Else
For $i = 0 To UBound($aKey) - 1
_GUICtrlComboBoxEx_SetCurSel($ahCombo[$i], RegRead($REG_PATH, $aKey[$i]))
Next
EndIf
EndFunc ;==>_ComboBoxReadSettings
Func _ComboBoxWhileSettings()
For $i = 0 To UBound($aKey) - 1
RegWrite($REG_PATH, $aKey[$i], "REG_SZ", _GUICtrlComboBoxEx_GetCurSel($ahCombo[$i]))
Next
EndFunc ;==>_ComboBoxWhileSettings
Func _ImageListComboBox($iIdContrl)
If @Compiled Then
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @ScriptFullPath, 1)
_GUIImageList_AddIcon($hImage, @ScriptFullPath, 2)
_GUIImageList_AddIcon($hImage, @ScriptFullPath, 3)
_GUIImageList_AddIcon($hImage, @ScriptFullPath, 4)
_GUIImageList_AddIcon($hImage, @ScriptFullPath, 5)
_GUICtrlComboBoxEx_SetImageList($iIdContrl, $hImage)
EndIf
EndFunc ;==>_ImageListComboBox
Func _ImageListButton($iIdContrl, $iIdIcon = 0)
If @Compiled Then
$hImage = _GUIImageList_Create(16, 16, 5, 1, 2)
_GUIImageList_AddIcon($hImage, @ScriptFullPath, $iIdIcon)
_GUICtrlButton_SetImageList($iIdContrl, $hImage)
EndIf
EndFunc ;==>_ImageListButton
Func _BitXOR_GUIInputEnableDisable()
If _GUICtrlComboBoxEx_GetCurSel($ahCombo[1]) = 2 Then ; BitXOR
For $i = 2 To 4
GUICtrlSetState($ahInput[$i], $GUI_DISABLE)
GUICtrlSetBkColor($ahInput[$i], $iBkColorDisable)
Next
Else
For $i = 2 To 4
GUICtrlSetState($ahInput[$i], $GUI_ENABLE)
GUICtrlSetBkColor($ahInput[$i], $iBkColorEnable)
Next
EndIf
EndFunc ;==>_BitXOR_GUIInputEnableDisable
Func _BitOR_GUIInputEnable()
If _GUICtrlComboBoxEx_GetCurSel($ahCombo[1]) = 1 Then ; BitOR
For $i = 0 To UBound($ahInput) - 2
GUICtrlSetState($ahInput[$i], $GUI_ENABLE)
GUICtrlSetBkColor($ahInput[$i], $iBkColorEnable)
Next
EndIf
EndFunc ;==>_BitOR_GUIInputEnable
Func _BitAND_GUIInputEnableDisable()
If _GUICtrlComboBoxEx_GetCurSel($ahCombo[1]) = 0 Then ; BitAND
For $i = 0 To UBound($ahInput) - 3
If GUICtrlRead($ahInput[$i]) = "" Or GUICtrlRead($ahInput[$i]) = "0x" Then
GUICtrlSetState($ahInput[$i + 1], $GUI_DISABLE)
GUICtrlSetData($ahInput[$i + 1], "")
GUICtrlSetBkColor($ahInput[$i + 1], $iBkColorDisable)
Else
GUICtrlSetState($ahInput[$i + 1], $GUI_ENABLE)
GUICtrlSetBkColor($ahInput[$i + 1], $iBkColorEnable)
If _GUICtrlComboBoxEx_GetCurSel($ahCombo[0]) = 1 And GUICtrlRead($ahInput[$i + 1]) = "" And GUICtrlRead($ahInput[$i]) <> "0x" Then GUICtrlSetData($ahInput[$i + 1], "0x")
EndIf
Next
EndIf
EndFunc ;==>_BitAND_GUIInputEnableDisable
Func _SetFunc()
_ComboBoxWhileSettings()
_BitXOR_GUIInputEnableDisable()
_BitAND_GUIInputEnableDisable()
_BitOR_GUIInputEnable()
_FieldsGUIInputDEC_NEX()
EndFunc ;==>_SetFunc
Func _FieldsGUIInputDEC_NEX()
Switch _GUICtrlComboBoxEx_GetCurSel($ahCombo[0])
Case 0 ; Dec
For $i = 0 To UBound($ahInput) - 2
GUICtrlSetData($ahInput[$i], "")
GUICtrlSetColor($ahInput[$i], $iColorDec)
Next
Case 1 ; Nex
For $i = 0 To UBound($ahInput) - 2
GUICtrlSetData($ahInput[$i], "0x")
GUICtrlSetColor($ahInput[$i], $iColorNEX)
Next
EndSwitch
GUICtrlSetColor($ahInput[5], 0xff0000)
If IsDeclared("sH") Then GUICtrlSetData($ahInput[5], "")
Global $sH
EndFunc ;==>_FieldsGUIInputDEC_NEX
Func _TotalCalculationOutput()
Local $sStr
For $i = 0 To UBound($aReadInput) - 1
If StringLower(GUICtrlRead($ahInput[$i])) = "0x" Or GUICtrlRead($ahInput[$i]) = "" Then
$aReadInput[$i] = 0
$sStr &= $aReadInput[$i]
Else
$aReadInput[$i] = GUICtrlRead($ahInput[$i])
EndIf
Next
If $sStr == "00000" Then
GUICtrlSetData($ahInput[5], "ERROR")
Return
EndIf
Switch _GUICtrlComboBoxEx_GetCurSel($ahCombo[1])
Case 0 ; AND
Local $sString
For $i = 0 To UBound($ahInput) - 2
If GUICtrlRead($ahInput[$i]) <> "" Then $sString &= GUICtrlRead($ahInput[$i]) & ","
Next
$aArray = StringSplit($sString, ",")
If $aArray[0] < 3 Then
GUICtrlSetData($ahInput[5], "ERROR")
Return
EndIf
Switch $aArray[0] - 1
Case 2 ; 2
$iTotal = BitAND($aReadInput[0], $aReadInput[1])
Case 3
$iTotal = BitAND($aReadInput[0], $aReadInput[1], $aReadInput[2])
Case 4
$iTotal = BitAND($aReadInput[0], $aReadInput[1], $aReadInput[2], $aReadInput[3])
Case 5
$iTotal = BitAND($aReadInput[0], $aReadInput[1], $aReadInput[2], $aReadInput[3], $aReadInput[4])
EndSwitch
GUICtrlSetData($ahInput[5], _Calculation($iTotal))
Case 1 ; OR
$iTotal = BitOR($aReadInput[0], $aReadInput[1], $aReadInput[2], $aReadInput[3], $aReadInput[4])
GUICtrlSetData($ahInput[5], _Calculation($iTotal))
Case 2 ; XOR
$iTotal = BitXOR($aReadInput[0], $aReadInput[1])
GUICtrlSetData($ahInput[5], _Calculation($iTotal))
EndSwitch
EndFunc ;==>_TotalCalculationOutput
Func _Calculation($iData)
Local $iTrim
Switch _GUICtrlComboBoxEx_GetCurSel($ahCombo[2])
Case 0 ; DEC
Return $iData
Case 1 ; NEX
Switch _GUICtrlComboBoxEx_GetCurSel($ahCombo[3])
Case 0 To 7
Return "0x" & Hex($iData, _GUICtrlComboBoxEx_GetCurSel($ahCombo[3]) + 1)
Case 8
$iNex = Hex($iData)
For $i = 1 To StringLen($iNex)
If StringMid($iNex, $i, 1) = "0" Then
$iTrim &= ""
Else
$iTrim &= StringMid($iNex, $i, 1)
EndIf
Next
Return "0x" & $iTrim
Case 9
$iNex = Hex($iData)
For $i = 1 To StringLen($iNex)
If StringMid($iNex, $i, 1) = "0" And StringMid($iNex, $i + 1, 1) = "0" Then
$iTrim &= ""
Else
$iTrim &= StringMid($iNex, $i, 1)
EndIf
Next
Return "0x" & $iTrim
EndSwitch
EndSwitch
EndFunc ;==>_Calculation
Func _Toggle_ExpandControls_Proc($hWnd, $iInitWndWidth, $iExpndWidth, $iExpndCtrlID, $sExpndText = "", $sCntrctText = "")
Local $iWidth, $sButtonText, $aSysCaptMetrics, $aSysBordMetrics
Local Const $SM_CXFIXEDFRAME = 7 ;Window border size
$aSysBordMetrics = DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CXFIXEDFRAME)
$aGuiPos = WinGetPos($hWnd)
If $aGuiPos[2] > $iExpndWidth Then
$iWidth = $iInitWndWidth + ($aSysBordMetrics[0] * 2)
$sButtonText = $sExpndText
Else
$iWidth = $iExpndWidth + ($aSysBordMetrics[0] * 2)
$sButtonText = $sCntrctText
EndIf
_ResourceSetImageToCtrl($Pic4, $sButtonText)
WinMove($hWnd, "", $aGuiPos[0], $aGuiPos[1], $iWidth, $aGuiPos[3])
EndFunc ;==>_Toggle_ExpandControls_Proc
Func _InstallFonts() ;~ cristal.TTF, Mic_____.ttf
Local $iReturn
If FileInstall("Res\cristal.TTF", @TempDir & "\cristal.TTF", 1) Then
$iReturn = _FileFontInstall(@TempDir & '\' & $aFontName[0][1])
;~ ConsoleWrite($iReturn & " - _FileFontInstall(" & @TempDir & '\' & $aFontName[0][1] & ")" & @CRLF)
EndIf
If FileInstall("Res\Mic_____.ttf", @TempDir & "\Mic_____.ttf", 1) Then
$iReturn = _FileFontInstall(@TempDir & '\' & $aFontName[1][1])
;~ ConsoleWrite($iReturn & " - _FileFontInstall(" & @TempDir & '\' & $aFontName[1][1] & ")" & @CRLF)
EndIf
EndFunc ;==>_InstallFonts
Func _FileFontInstall($sSourceFile, $sFontDescript = "", $sFontsPath = "")
Local Const $HWND_BROADCAST = 0xFFFF
Local Const $WM_FONTCHANGE = 0x1D
If $sFontsPath = "" Then $sFontsPath = @WindowsDir & "\Fonts"
Local $sFontName = StringRegExpReplace($sSourceFile, "^.*\\", "")
If Not FileCopy($sSourceFile, $sFontsPath & "\" & $sFontName, 1) Then Return SetError(1, 0, 0)
Local $hSearch = FileFindFirstFile($sSourceFile)
Local $iFontIsWildcard = StringRegExp($sFontName, "\*|\?")
Local $aRet, $hGdi32_DllOpen = DllOpen("GDI32.dll")
If $hSearch = -1 Then Return SetError(2, 0, 0)
If $hGdi32_DllOpen = -1 Then Return SetError(3, 0, 0)
While 1
$sFontName = FileFindNextFile($hSearch)
If @error Then ExitLoop
If $iFontIsWildcard Then $sFontDescript = StringRegExpReplace($sFontName, "\.[^\.]*$", "")
$aRet = DllCall($hGdi32_DllOpen, "Int", "AddFontResource", "str", $sFontsPath & "\" & $sFontName)
If IsArray($aRet) And $aRet[0] > 0 Then
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts", _
$sFontDescript, "REG_SZ", $sFontsPath & "\" & $sFontName)
EndIf
WEnd
DllClose($hGdi32_DllOpen)
DllCall("User32.dll", "Int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_FONTCHANGE, "int", 0, "int", 0)
Return 1
EndFunc ;==>_FileFontInstall
Func _ProtectRepeatedStart()
$aWinList = WinList()
For $i = 1 To $aWinList[0][0]
If $aWinList[$i][0] <> "" And _IsVisible($aWinList[$i][1]) Then
$shRegReadWnd = RegRead($REG_PATH, "WinGetHandle")
If $aWinList[$i][1] = $shRegReadWnd Then
_WinAPI_FlashWindow($shRegReadWnd)
Sleep(1000)
Exit
EndIf
EndIf
Next
EndFunc ;==>_ProtectRepeatedStart
Func _IsVisible($handle)
If BitAND(WinGetState($handle), 2) Then Return 1
Return 0
EndFunc ;==>_IsVisible
Func _ExitScript()
RegWrite($REG_PATH, "WinGetHandle", "REG_SZ", "")
Exit
EndFunc ;==>_ExitScript
Func _AddRegCopyright()
RegWrite($REG_PATH, "Autor", "REG_SZ", "FlatX007")
RegWrite($REG_PATH, "Name", "REG_SZ", $NAME_PROGRAM)
RegWrite($REG_PATH, "Version", "REG_SZ", $VERSION_PROGRAM)
RegWrite($REG_PATH, "InstallPath", "REG_SZ", @ScriptFullPath)
EndFunc ;==>_AddRegCopyright
Func _Sound_Play($fSoundPlay = False, $vResName = 0, $fSync = True)
If $fSync = False Then $SND_MU_ASYNC = $SND_ASYNC
If $fSync = True Then $SND_MU_ASYNC = 0
If $fSoundPlay = True Then _ResourcePlaySound($vResName, $SND_MU_ASYNC)
EndFunc ;==>_Sound_Play
Func _WinAPICreateRectRgn_Round()
$Pos = WinGetPos($hGUI)
$rgn = _WinAPI_CreateRoundRectRgn(0, 30, $Pos[2], $Pos[3], $Pos[1] / 10, $Pos[3] / 12)
_WinAPI_SetWindowRgn($hGUI, $rgn)
EndFunc ;==>_WinAPICreateRectRgn_Round
Func _WinAPICreateRectRgn_Default()
$Pos = WinGetPos($hGUI)
$rgn = _WinAPI_CreateRectRgn(0, 30, $Pos[2], $Pos[3])
_WinAPI_SetWindowRgn($hGUI, $rgn)
EndFunc ;==>_WinAPICreateRectRgn_Default
Func _Lang($iLang = $LANG_RUS)
Local $aLANG
Switch $iLang
Case $LANG_RUS
$sReadLang = _ResourceGetAsString($LANG_RUS)
If Not (@error) Then
$aLANG = StringSplit($sReadLang, "@")
Else
$aLANG = StringSplit(FileRead("Res\LangRUS.txt"), "@")
EndIf
Return $aLANG
Case $LANG_ENG
$sReadLang = _ResourceGetAsString($LANG_ENG)
If Not (@error) Then
$aLANG = StringSplit($sReadLang, "@")
Else
$aLANG = StringSplit(FileRead("Res\LangENG.txt"), "@")
EndIf
Return $aLANG
EndSwitch
Return SetError(1, 0, 0)
EndFunc ;==>_Lang
Для компиляции заполняем папку Utilities соответствующими программами:
http://www.autoitscript.com/autoit3/scite/download - http://www.autoitscript.com/autoit3/scite/download/AutoIt3Wrapper.exe
http://bogdan.at.ua/reshack/index.html - http://bogdan.at.ua/reshack/reshack.zip
http://upx.sourceforge.net/#download - http://upx.sourceforge.net/download/upx304w.zip
Кое что конечно не получилось, просьба поправить.
1. Фильтр для ввода только HEX чисел
2. Остальное я сам поправлю как будет время :whistle: