hallo leute
als erstes möchte ich mich bei "Ludwig" bedanken, der mir eine vorlage für meine gui erstellt hat, die ich frei anpassen kann.
ich brauchte über das wochenende, einen ascii-hex-konverter um einen wifi-passphrase herauszufinden.
eigentlich nichts grosses, aber mir ging es auch vorallem darum, eine gui mit einem png zu erstellen.
aber vielleicht kann es trotzdem jemand gebrauchen.
Spoiler anzeigen
;------------------------------- Includes ---------------------------------------------
#include <GDIPlus.au3>
#include <GuiComboBox.au3>
#include <File.au3>
#include <Array.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiMenu.au3>
#include <ButtonConstants.au3>
#include <String.au3>
;------------------------------- Wrapper ---------------------------------------------
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=ico\ascii-icon.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;----------------------------------------------------------------------------
HotKeySet("{ESC}", "_exit")
HotKeySet("{ENTER}", "_convert")
Global Const $AC_SRC_ALPHA = 1
Dim $selectedButton = "ascii"
#cs ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]AutoIt Version: 3.3.6.1
Author: Gianni
#ce ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup()
$pngSrc = @ScriptDir & "\gui\gui.png"
$hImage = _GDIPlus_ImageLoadFromFile($pngSrc)
$width = _GDIPlus_ImageGetWidth($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)
$GUI = GUICreate("Ascii-Hex-Converter", $width, $height, -1, -1, BitOR($WS_POPUP, $WS_SYSMENU), $WS_EX_LAYERED)
[/autoit] [autoit][/autoit] [autoit]SetBitmap($GUI, $hImage, 0)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState()
For $i = 0 To 255 Step 40
Sleep(5)
SetBitmap($GUI, $hImage, $i)
Next
SetBitmap($GUI, $hImage, 255)
$WinPos = WinGetPos($GUI)
[/autoit] [autoit][/autoit] [autoit]$_X = GUICreate("", $width, $height, 0, 0, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_TOOLWINDOW, $WS_EX_LAYERED), $GUI)
GUICtrlCreatePic(@ScriptDir & "\gui\grey.gif", 0, 0, $width, $height)
GUICtrlSetState(-1, $GUI_DISABLE)
$btnAsciiHex = GUICtrlCreateButton("Ascii 2 Hex", 25, 45, 91, 25, $BS_FLAT)
$btnHexAscii = GUICtrlCreateButton("Hex 2 Ascii", 135, 45, 91, 25, $BS_FLAT)
$txtInput1 = GUICtrlCreateInput("", 25, 85, 201, 21)
$txtInput2 = GUICtrlCreateInput("", 25, 125, 201, 21)
$labelInput1 = GUICtrlCreateLabel("Ascii", 235, 85, 37, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$labelInput2 = GUICtrlCreateLabel("Hex", 235, 125, 37, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState()
[/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $btnAsciiHex
GUICtrlSetData($labelInput1, "Ascii")
GUICtrlSetData($labelInput2, "Hex")
$selectedButton = "ascii"
Case $btnHexAscii
GUICtrlSetData($labelInput2, "Ascii")
GUICtrlSetData($labelInput1, "Hex")
$selectedButton = "hex"
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
For $i = 200 To 0 Step -40
SetBitmap($GUI, $hImage, $i)
Next
_WinAPI_DeleteObject($hImage)
_GDIPlus_Shutdown()
;------------------------------- Functions ---------------------------------------------
[/autoit] [autoit][/autoit] [autoit]Func _convert()
Switch $selectedButton
Case "ascii"
$input1 = GUICtrlRead($txtInput1)
$ascii = _StringToHex($input1)
GUICtrlSetData($txtInput2, $ascii)
Case "hex"
$input1 = GUICtrlRead($txtInput1)
$hex = _HexToString($input1)
GUICtrlSetData($txtInput2, $hex)
EndSwitch
EndFunc
Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc ;==>WM_NCHITTEST
Func SetBitmap($hGUI, $hImage, $iOpacity)
Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
$hScrDC = _WinAPI_GetDC(0)
$hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", $iOpacity)
DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
_WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
_WinAPI_ReleaseDC(0, $hScrDC)
_WinAPI_SelectObject($hMemDC, $hOld)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteDC($hMemDC)
EndFunc ;==>SetBitmap
Func _exit()
Exit
EndFunc
grüsse
gianni