Ich weiß nicht, wo für das gut sein soll, aber ich habe es einfach mal programmiert, nach dem SEuBO, Andy, Oscar und Progandy ihren Beitrag zu diesem Thema geleistet haben!
Spoiler anzeigen
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_Run_After=del /f /q "Fussball Chronograph_Obfuscated.au3"
#AutoIt3Wrapper_Res_Description=Fussball Chronograph v1.4 by (c) UEZ 2010
#AutoIt3Wrapper_Res_Fileversion=1.4
#AutoIt3Wrapper_Res_LegalCopyright=UEZ 2010
#AutoIt3Wrapper_Res_Language=1031
#AutoIt3Wrapper_Res_Field=Coded by|UEZ
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Icon="Images\Fussball Chronograph.ico"
;~ #AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%"
#AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
#Region includes
#include <ButtonConstants.au3>
#include <FontConstants.au3>
#include <GDIplus.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <Sound.au3>
#include <StaticConstants.au3>
#Include <String.au3>
#include <WindowsConstants.au3>
#EndRegion
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
#Region Dateien Check
If Not FileExists(@ScriptDir & "\Images\Hintergrund.jpg") Then
MsgBox(16, "Error", "Datei 'Images\Hintergrund.jpg' nicht gefunden!" & @CRLF & @CRLF & _
"Programm wird beendet!", 15)
Exit
EndIf
If Not FileExists(@ScriptDir & "\Images\Stoppuhr.png") Then
MsgBox(16, "Error", "Datei 'Images\Stoppuhr.png' nicht gefunden!" & @CRLF & @CRLF & _
"Programm wird beendet!", 15)
Exit
EndIf
If Not FileExists(@ScriptDir & "\Audio\Whistle_Start.mp3") Then
MsgBox(16, "Error", "Datei 'Audio\Whistle_Start.mp3' nicht gefunden!" & @CRLF & @CRLF & _
"Programm wird beendet!", 15)
Exit
EndIf
If Not FileExists(@ScriptDir & "\Audio\Whistle_End.mp3") Then
MsgBox(16, "Error", "Datei 'Audio\Whistle_End.mp3' nicht gefunden!" & @CRLF & @CRLF & _
"Programm wird beendet!", 15)
Exit
EndIf
#EndRegion
#Region General parameters
Local $titel = "Fussball Chronograph v1.4"
Local $build = " Build 2010-03-09"
Local $coder = "by UEZ 2010"
Local $os = @OSBuild
Switch $os
Case 0 To 3790
Local $StatusBar_Text = $titel & " " & $coder & "......................................................................................."
Local $SB_i = 160, $SB_j = 1, $SB_i_limes = 79, $space_string = "."
Case Else
Local $StatusBar_Text = $titel & " " & $coder
Local $SB_i = 195, $SB_j = 1, $SB_i_limes = 101, $space_string = " "
EndSwitch
Local $StatusBar_checked = False
Local $audio = True
Local $zeit_puffer1, $zeit_puffer2, $zeit_puffer3, $zeit_puffer4, $zeit_netto, $zeiger
Local $limes = 59
Local $halbzeit = 0
Local $status = 1 ;"Anpfiff"
#EndRegion
#Region Ini
Local $AoT, $audio
Local $ini = @ScriptDir & "\Fussball Chronograph.ini"
If Not FileExists($ini) Then
Create_Ini(1)
Else
$AoT = IniRead($ini, "Einstellungen", "AoT", "1")
$audio = IniRead($ini, "Einstellungen", "Audio", "1")
EndIf
#EndRegion
#region GUI About Initialisierung
Local $hGUI_About, $hGraphic_About, $hDC, $hCDC, $hTheme
Local $hbackground, $hDIBBmp, $hOldBmp, $hFont_About, $hOldFont, $hBrush
Local $pBitmapData, $tBmpInfo, $tDTTOptions, $pDTTOptions, $tClientRect, $pClientRect
Local $hBMP_About, $hImage_About, $hBitmap_About, $hBackbuffer_About, $hScrDC, $hDC_backbuffer, $DC_obj, $hBackbuffer_About
Local $iXX = 900, $iYY = 400
Local $fHigh = 50, $fWidth = 30, $fESC = 0, $fOrient = 0, $fWeight = 500
Local $fItalic = 0, $fUnderline = 0, $fStrikeout = 0
Local $fCharset = $DEFAULT_CHARSET, $fOutputPrec = $OUT_DEFAULT_PRECIS, $fClipPrec = $CLIP_DEFAULT_PRECIS, $fQuality = $PROOF_QUALITY
Local $fPitch = $DEFAULT_PITCH, $fFace = 'Courier New'
Local $fGlowsize = 16
Local $atext = @CRLF & $titel & $build & @CRLF & @CRLF & "by UEZ 2010"
#endregion
#Region GUI Initialisierung
Local Const $iX = 518
Local Const $iY = 732
Local $hWnd = GUICreate($titel & $build, $iX, $iY, -1, -1, $WS_SYSMENU)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Ende")
Local $MenuItem1, $MenuItem2, $MenuItem3, $MenuItem4, $MenuItem5, $MenuItem6, $MenuItem7, $MenuItem8
$MenuItem1 = GUICtrlCreateMenu("&?")
$MenuItem3 = GUICtrlCreateMenu("Einstellungen", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Always on top", $MenuItem3)
If $AoT = 1 Then
GUICtrlSetState(-1, $GUI_CHECKED)
WinSetOnTop($hwnd, "", True)
EndIf
GUICtrlSetOnEvent(-1, "Settings_GUI")
$MenuItem7 = GUICtrlCreateMenuItem("Audio", $MenuItem3)
If $audio = 1 Then GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetOnEvent(-1, "Settings_Audio")
$MenuItem8 = GUICtrlCreateMenuItem("Reset", $MenuItem1, -1 , 0)
GUICtrlSetOnEvent(-1, "Reset2")
$MenuItem2 = GUICtrlCreateMenuItem("Über", $MenuItem1, -1 , 0)
GUICtrlSetOnEvent(-1, "About")
$MenuItem5 = GUICtrlCreateMenuItem("", $MenuItem1, -1 , 1)
$MenuItem6 = GUICtrlCreateMenuItem("Ende", $MenuItem1, -1 , 0)
GUICtrlSetOnEvent(-1, "_Ende")
Local $Progress1 = GUICtrlCreateProgress(20, 22, 34, 352, $PBS_SMOOTH + $PBS_VERTICAL + $WS_BORDER)
GUICtrlSetData(-1, 0)
Local $Progress2 = GUICtrlCreateProgress(458, 22, 34, 352, $PBS_SMOOTH + $PBS_VERTICAL + $WS_BORDER)
GUICtrlSetData(-1, 0)
Local $Pic1 = GUICtrlCreatePic("Images\Hintergrund.jpg", 0, -15, $iX, $iY, $WS_GROUP + $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, 128)
Local $Button = GUICtrlCreateButton("&Anpfiff", 12, 568, 488, 57, -1, -1)
GUICtrlSetState(-1, $GUI_ENABLE)
GUICtrlSetFont(-1, 32, 400, 0, "Arial")
Local $timer_start, $timer, $zeit = "00:00"
GUICtrlSetOnEvent(-1, "Check_Status")
Local $Checkbox = GUICtrlCreateCheckbox("", 12, 639, 14, 14)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetOnEvent($Checkbox, "Check_Checkbox")
Local $Label2 = GUICtrlCreateLabel("Verlängerung", 28, 639, 70, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBKColor(-1, $GUI_BKCOLOR_TRANSPARENT)
Local $StatusBar = _GUICtrlStatusBar_Create($hWnd)
[/autoit] [autoit][/autoit] [autoit]Local $Group1 = GUICtrlCreateGroup("", 12, 384, 488, 166)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()
Display_Rotated_Text($hWnd, "1. Halbzeit", 6, 373, 90, 800)
Display_Rotated_Text($hWnd, "2. Halbzeit", 506, 319, 270, 800)
#EndRegion
#Region GDI+ Initialisation
_GDIPlus_Startup()
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
Local $hBitmap_clock = _GDIPlus_BitmapCreateFromGraphics(352, 348, $hGraphics)
Local $hBackbuffer_clock = _GDIPlus_ImageGetGraphicsContext($hBitmap_clock)
Local $hBitmap_time = _GDIPlus_BitmapCreateFromGraphics(433, 156, $hGraphics)
Local $hBackbuffer_time = _GDIPlus_ImageGetGraphicsContext($hBitmap_time)
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer_time, 2)
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer_clock, 2)
Local $hImage = _GDIPlus_BitmapCreateFromFile("Images\Stoppuhr.png")
Local Const $cX = _GDIPlus_ImageGetWidth($hImage)
Local Const $cY = _GDIPlus_ImageGetHeight($hImage)
Local $hBackround = _GDIPlus_BitmapCreateFromFile("Images\Hintergrund.jpg")
Local $hPen1 = _GDIPlus_PenCreate(0xFF101030, 5) ;grosser Zeiger Hintergrund
Local $hPen2 = _GDIPlus_PenCreate(0xFFC0C080, 1) ;grosser Zeiger Vordergrund
Local $hPen3 = _GDIPlus_PenCreate(0xFF101060, 3) ;kleiner Zeiger
Local $hPen4 = _GDIPlus_PenCreate(0xFF302040, 7) ;Knopf in der Mitte
Local $hPen5 = _GDIPlus_PenCreate(0xFF808020, 2) ;Licht auf Knopf
Local $hBrush_font = _GDIPlus_BrushCreateSolid(0xFF000000)
Local $hBrush_clock_g = _GDIPlus_BrushCreateSolid(0x8000E000)
Local $hBrush_clock_r = _GDIPlus_BrushCreateSolid(0x80D00000)
Local $hFormat = _GDIPlus_StringFormatCreate ()
Local $hFamily = _GDIPlus_FontFamilyCreate ("Arial")
Local $hFont = _GDIPlus_FontCreate ($hFamily, 110, 0)
Local $tLayout = _GDIPlus_RectFCreate (0, 0, 433, 156)
Local $hPath, $hCustomLineCap, $avCaps, $GDIP_STATUS
Local Const $LineCapTriangle = 3, $LineCapRound = 2, $DashCapFlat = 0
$hPath = _GDIPlus_PathCreate()
$hCustomLineCap = _GDIPlus_CustomLineCapCreate(0, $hPath)
_GDIPlus_CustomLineCapSetStrokeCaps($hCustomLineCap, $LineCapRound, $LineCapTriangle)
$avCaps = _GDIPlus_CustomLineCapGetStrokeCaps($hCustomLineCap)
_GDIPlus_PenSetLineCap($hPen1, $avCaps[0], $avCaps[1], $DashCapFlat)
Local Const $small_needle_radius = 50
Local Const $small_needle_x = 177
Local Const $small_needle_y = 113
Local Const $big_needle_diameter = 325
Local Const $big_needle_radius1 = 50
Local Const $big_needle_radius2 = $big_needle_diameter / 2 - 6
Local Const $big_needle_x = $cX / 2
Local Const $big_needle_y = $cY / 2
Local Const $big_needle_button = 8
Local Const $pie_size = 13
Local Const $pi_div_180 = 4 * ATan(1) / 180
Draw_GDIp(0, 0)
#EndRegion
Local $pfeife_start = _SoundOpen("Audio\Whistle_Start.mp3")
Local $pfeife_ende = _SoundOpen("Audio\Whistle_End.mp3")
AdlibRegister("Move_Text", 200)
[/autoit] [autoit][/autoit] [autoit]GUIRegisterMsg($WM_PAINT, "Redraw_GUI")
[/autoit] [autoit][/autoit] [autoit]While Sleep(100000)
WEnd
Func Check_Status()
Switch $status
Case 1 ;"Anpfiff"
If $audio = 1 Then _SoundPlay($pfeife_start, 0)
$timer_start = TimerInit()
AdlibRegister("Timer", 1000)
GUICtrlSetData($Button, "&Ende 1. Halbzeit")
$status = 2 ;"Halbzeit"
Case 2 ;"Halbzeit"
AdlibUnRegister("Timer")
$zeit_puffer1 = $zeit
Display_Rotated_Text($hWnd, $zeit_puffer1, 54, 372, 90, 800)
If $audio = 1 Then _SoundPlay($pfeife_ende, 0)
$halbzeit = 45
GUICtrlSetData($Button, "&Start 2. Halbzeit")
$status = 3
Case 3 ;"2. Halbzeit"
Reset_Zeiger()
If $audio = 1 Then _SoundPlay($pfeife_start, 0)
$timer_start = TimerInit()
AdlibRegister("Timer", 1000)
GUICtrlSetData($Button, "&Ende 2. Halbzeit")
$status = 4
Case 4 ;"Ende"
AdlibUnRegister("Timer")
$zeit_puffer2 = $zeit_netto
Display_Rotated_Text($hWnd, $zeit_puffer2, 458, 345, 270, 800)
If $audio = 1 Then _SoundPlay($pfeife_ende, 0)
GUICtrlSetState($Checkbox, $GUI_ENABLE)
GUICtrlSetData($Button, "&Ende")
$status = 5
Case 5;"1. Verlängerung"
If GUICtrlRead($Button) <> "&Ende" Then
Switch GUICtrlRead($Checkbox)
Case 1
GUICtrlSendMsg($Progress1, 0x0410, 1, 0)
GUICtrlSetState($Checkbox, $GUI_DISABLE)
GUICtrlSetData($Progress1, 0)
GUICtrlSetData($Progress2, 0)
Reset_Zeiger()
If $audio = 1 Then _SoundPlay($pfeife_start, 0)
$halbzeit = 90
$limes = 30
$timer_start = TimerInit()
AdlibRegister("Timer", 1000)
GUICtrlSetData($Button, "&Ende 1. Verlängerung")
$status = 6
EndSwitch
Else
Reset()
EndIf
Case 6 ;"Halbzeit Verlängerung"
AdlibUnRegister("Timer")
$zeit_puffer3 = $zeit_netto
Display_Rotated_Text($hWnd, $zeit_puffer3, 54, 337, 90, 800)
If $audio = 1 Then _SoundPlay($pfeife_ende, 0)
GUICtrlSetData($Button, "&Verlängerung 2. Halbzeit")
$status = 7
Case 7 ;"2. Verlängerung"
GUICtrlSendMsg($Progress2, 0x0410, 1, 0)
Reset_Zeiger()
If $audio = 1 Then _SoundPlay($pfeife_start, 0)
$halbzeit = 105
$timer_start = TimerInit()
AdlibRegister("Timer", 1000)
GUICtrlSetData($Button, "&Ende 2. Verlängerung")
$status = 8
Case 8 ;"Spiel Ende"
AdlibUnRegister("Timer")
$zeit_puffer4 = $zeit_netto
Display_Rotated_Text($hWnd, $zeit_puffer4, 458, 310, 270, 800)
If $audio = 1 Then _SoundPlay($pfeife_ende, 0)
GUICtrlSetData($Button, "&Neustart")
$status = 9
Case 9 ;Neustart
Reset()
EndSwitch
EndFunc
Func Reset_Zeiger($schlafe = 5)
Local $i
GUICtrlSetState($Button, $GUI_DISABLE)
For $i = Int($zeiger) To 0 Step - 1
Draw_GDIp(0, $i)
Sleep($schlafe)
Next
GUICtrlSetState($Button, $GUI_ENABLE)
EndFunc
Func Timer()
Local $sec, $min, $t = TimerDiff($timer_start) ;* 88 ;Turbo Zeit zum Testen
$sec = Floor(Mod($t / 1000, 60))
$min = Floor($t / (1000 * 60)) + $halbzeit
$zeit_netto = StringFormat("%02d:%02d", $min - $halbzeit, $sec)
$zeit = StringFormat("%02d:%02d", $min, $sec)
If $min - $halbzeit <= $limes Then
Switch $status
Case 2
If $min > 45 Then GUICtrlSendMsg($Progress1, 0x0410, 2, 0)
GUICtrlSetData($Progress1, $min * 1.66666667)
Case 6
$min -= $halbzeit
If $min > 15 Then GUICtrlSendMsg($Progress1, 0x0410, 2, 0)
GUICtrlSetData($Progress1, $min * 1.66666667)
Case 4, 8
$min -= $halbzeit
If $min > 45 And $status = 4 Then GUICtrlSendMsg($Progress2, 0x0410, 2, 0)
If $min > 15 And $status = 8 Then GUICtrlSendMsg($Progress2, 0x0410, 2, 0)
GUICtrlSetData($Progress2, $min * 1.66666667)
EndSwitch
$zeiger = $min + $sec / 60
Draw_GDIp($sec, $zeiger)
Else
AdlibUnRegister("Timer")
EndIf
EndFunc
Func Check_Checkbox()
If BitAND(GUICtrlRead($Checkbox), $GUI_CHECKED) Then
GUICtrlSetData($Button, "&Start Verlängerung")
Else
GUICtrlSetData($Button, "&Ende")
EndIf
EndFunc
Func Draw_GDIp($angle_small, $angle_big)
Local $x1, $x2, $y1, $y2
Local $xx1, $xx2, $yy1, $yy2
$angle_small -= 270
_GDIPlus_GraphicsClear($hBackbuffer_clock, 0x00000000)
_GDIPlus_GraphicsDrawImage($hBackbuffer_clock, $hImage, 0, 0) ;zeichne Uhr, damit die Zeiger gelöscht werden
_GDIPlus_GraphicsDrawImageRectRect($hBackbuffer_time, $hBackround, 36, 394, 433, 156, 0, 0, 433, 156) ;zeichne Stadion, damit die Zeiger gelöscht werden
_GDIPlus_GraphicsDrawLine($hBackbuffer_clock, $small_needle_x, $small_needle_y, _ ;zeichne kleinen Zeiger
$small_needle_x + $small_needle_radius * Sin($angle_small * -6 * $Pi_Div_180), _
$small_needle_y + $small_needle_radius * Cos($angle_small * -6 * $Pi_Div_180), $hPen3)
Switch $status ;zeichne Kreisdiagramm
Case 2, 4
Switch $angle_big
Case 45 To 60
_GDIPlus_GraphicsFillPie($hBackbuffer_clock, $pie_size, $pie_size, $big_needle_diameter, $big_needle_diameter, -90, 45 * 6, $hBrush_clock_g)
_GDIPlus_GraphicsFillPie($hBackbuffer_clock, $pie_size, $pie_size, $big_needle_diameter, $big_needle_diameter, -180, ($angle_big - 45) * 6, $hBrush_clock_r)
Case Else
_GDIPlus_GraphicsFillPie($hBackbuffer_clock, $pie_size, $pie_size, $big_needle_diameter, $big_needle_diameter, -90, $angle_big * 6, $hBrush_clock_g)
EndSwitch
Case 6, 8
Switch $angle_big
Case 15 To 30
_GDIPlus_GraphicsFillPie($hBackbuffer_clock, $pie_size, $pie_size, $big_needle_diameter, $big_needle_diameter, -90, 15 * 6, $hBrush_clock_g)
_GDIPlus_GraphicsFillPie($hBackbuffer_clock, $pie_size, $pie_size, $big_needle_diameter, $big_needle_diameter, 0, ($angle_big - 15) * 6, $hBrush_clock_r)
Case Else
_GDIPlus_GraphicsFillPie($hBackbuffer_clock, $pie_size, $pie_size, $big_needle_diameter, $big_needle_diameter, -90, $angle_big * 6, $hBrush_clock_g)
EndSwitch
EndSwitch
$x1 = $big_needle_x - $big_needle_radius1 * Sin(($angle_big - 210) * -6 * $Pi_Div_180)
$y1 = $big_needle_y - $big_needle_radius1 * Cos(($angle_big - 210) * -6 * $Pi_Div_180)
$x2 = $big_needle_x + $big_needle_radius2 * Sin(($angle_big - 30) * -6 * $Pi_Div_180)
$y2 = $big_needle_y + $big_needle_radius2 * Cos(($angle_big - 30) * -6 * $Pi_Div_180)
$xx1 = $big_needle_x - ($big_needle_radius1 - 2 )* Sin(($angle_big - 210) * -6 * $Pi_Div_180)
$yy1 = $big_needle_y - ($big_needle_radius1 - 2 ) * Cos(($angle_big - 210) * -6 * $Pi_Div_180)
$xx2 = $big_needle_x + ($big_needle_radius2 - 3) * Sin(($angle_big - 30) * -6 * $Pi_Div_180)
$yy2 = $big_needle_y + ($big_needle_radius2 - 3) * Cos(($angle_big - 30) * -6 * $Pi_Div_180)
_GDIPlus_GraphicsDrawLine($hBackbuffer_clock, $x1, $y1, $x2, $y2, $hPen1) ;zeichne großen Zeiger
_GDIPlus_GraphicsDrawLine($hBackbuffer_clock, $xx1, $yy1, $xx2, $yy2, $hPen2) ;zeichne Linie auf großen Zeiger
_GDIPlus_GraphicsDrawEllipse($hBackbuffer_clock, $big_needle_x - $big_needle_button * 0.5, $big_needle_y - $big_needle_button * 0.5, _ ;Knopf
$big_needle_button, $big_needle_button, $hPen4)
_GDIPlus_GraphicsDrawArc ($hBackbuffer_clock, $big_needle_x - $big_needle_button * 0.5, $big_needle_y - $big_needle_button * 0.5, _ ;Licht auf Knopf
$big_needle_button, $big_needle_button, 50, -180, $hPen5)
_GDIPlus_GraphicsDrawStringEx ($hBackbuffer_time, $zeit, $hFont, $tLayout, $hFormat, $hBrush_font) ;zeichne Spielzeit
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap_time, 38, 392, 433, 156) ;kopiere Spielzeit in die GUI
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap_clock, 80, 24, 352, 348) ;kopiere Uhr in die GUI
EndFunc
Func Reset()
$zeit = "00:00"
$limes = 60
$halbzeit = 0
GUICtrlSetData($Button, "&Anpfiff")
GUICtrlSetState($Checkbox, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox, $GUI_DISABLE)
GUICtrlSetData($Progress1, 0)
GUICtrlSetData($Progress2, 0)
$zeit = "00:00"
Reset_Zeiger()
$status = 1
GUICtrlSendMsg($Progress1, 0x0410, 1, 0)
GUICtrlSendMsg($Progress2, 0x0410, 1, 0)
_WinAPI_RedrawWindow($hWnd, "", "", $RDW_INVALIDATE)
EndFunc
Func Reset2()
Local $chk
WinSetOnTop($hwnd, "", False)
$chk = MsgBox(4, "Reset", "Wirklich alles resetten?")
If $chk = 6 Then
AdlibUnRegister("Timer")
Reset()
EndIf
If BitAND(GUICtrlRead($MenuItem4), $GUI_CHECKED) = $GUI_CHECKED Then WinSetOnTop($hwnd, "", True)
EndFunc
Func _Ende()
$AoT = BitAND(GUICtrlRead($MenuItem4), $GUI_CHECKED)
$audio = BitAND(GUICtrlRead($MenuItem7), $GUI_CHECKED)
WinSetOnTop($hwnd, "", False)
Local $box = MsgBox(36, "Ende", "Soll das Programm wirklich geschlossen werden?")
If $box = 7 Then
If $AoT = $GUI_CHECKED Then WinSetOnTop($hwnd, "", True)
Return
EndIf
Create_Ini(0, $AoT, $audio)
_SoundClose($pfeife_start)
_SoundClose($pfeife_ende)
AdlibUnRegister("Timer")
GUIRegisterMsg($WM_PAINT, "")
_GDIPlus_CustomLineCapDispose($hCustomLineCap)
_GDIPlus_PathDispose($hPath)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_PenDispose($hPen1)
_GDIPlus_PenDispose($hPen2)
_GDIPlus_PenDispose($hPen3)
_GDIPlus_PenDispose($hPen4)
_GDIPlus_PenDispose($hPen5)
_GDIPlus_BrushDispose($hBrush_clock_g)
_GDIPlus_BrushDispose($hBrush_clock_r)
_GDIPlus_BrushDispose($hBrush_font)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ImageDispose($hBackround)
_GDIPlus_BitmapDispose($hBitmap_clock)
_GDIPlus_GraphicsDispose($hBackbuffer_clock)
_GDIPlus_BitmapDispose($hBitmap_time)
_GDIPlus_GraphicsDispose($hBackbuffer_time)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
AdlibUnRegister("Move_Text")
GUIDelete($hwnd)
Exit
EndFunc
Func Move_Text()
Local $txt
$txt = _StringRepeat($space_string, $SB_i) & $StatusBar_Text
_GUICtrlStatusBar_SetText($StatusBar, $txt)
$SB_i -= $SB_j
If $SB_i = 0 Or ($SB_i = $SB_i_limes And $StatusBar_checked) Then
$SB_j *= -1
$StatusBar_checked = True
EndIf
EndFunc
;danke an BugFix für das Beispiel
Func Display_Rotated_Text($hGUI, $text, $px, $py, $angle = 90, $tw = 400, $th = 12, $tcolor = 0x000000, $bcolor = 0xF0F0F0, $font = 'Arial', $transparent = True)
Local $tRect, $rotate, $RotateMe, $rFont, $hDC
; Create RECT-structure, fill data
$tRect = DllStructCreate ($tagRECT)
DllStructSetData ($tRect, 'Left', $px)
DllStructSetData ($tRect, 'Top', $py)
; Set rotation
$rotate = $angle * 10
; Create structure for rotate text, fill data
$RotateMe = DllStructCreate ($tagLOGFONT)
DllStructSetData ($RotateMe, 'Escapement', $rotate)
DllStructSetData ($RotateMe, 'Weight', $tw)
DllStructSetData ($RotateMe, 'Height', $th)
DllStructSetData ($RotateMe, 'FaceName', $font)
; Creates a logical font that has specific characteristics
$rFont = _WinAPI_CreateFontIndirect ($RotateMe)
; Retrieves a handle of a display device context for the client area a window
$hDC = _WinAPI_GetDC ($hGUI)
; Set text- and back color
_WinAPI_SetTextColor ($hDC, $tcolor)
_WinAPI_SetBkColor ($hDC, $bcolor)
If $transparent Then _WinAPI_SetBkMode($hDC, $TRANSPARENT)
; Selects an object into the specified device context
_WinAPI_SelectObject ($hdc, $rFont)
; Draws formatted text in the specified rectangle
_WinAPI_DrawText ($hDC, $text, $tRect, $DT_NOCLIP + $DT_NOPREFIX)
$tRect = 0
EndFunc
Func Settings_GUI()
If BitAND(GUICtrlRead($MenuItem4), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($MenuItem4, $GUI_UNCHECKED)
;~ GUISetStyle(0x14C80000, -1, $hWnd)
WinSetOnTop($hwnd, "", False)
Else
GUICtrlSetState($MenuItem4, $GUI_CHECKED)
;~ GUISetStyle(0x14C80000, 0x00000108, $hWnd)
WinSetOnTop($hwnd, "", True)
EndIf
EndFunc
Func Settings_Audio()
If BitAND(GUICtrlRead($MenuItem7), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($MenuItem7, $GUI_UNCHECKED)
$audio = False
Else
GUICtrlSetState($MenuItem7, $GUI_CHECKED)
$audio = True
EndIf
EndFunc
Func Create_Ini($new = 1, $val1 = 1, $val2 = 1)
Local $err
If $new = 1 Then
IniWriteSection($ini, "Einstellungen", "AoT=1" & @LF & "Audio=1")
$err = @error
$AoT = 1
$audio = 1
Else
IniWriteSection($ini, "Einstellungen", "AoT=" & $val1 & @LF & "Audio=" & $val2)
$err = @error
EndIf
Return $err
EndFunc
Func Redraw_GUI($hWnd, $msg, $wParam, $lParam)
_WinAPI_RedrawWindow($hWnd, "", "", $RDW_UPDATENOW + $RDW_FRAME)
Redraw_GUI_GDIp()
Return $GUI_RUNDEFMSG
EndFunc ;==>Redraw_GUI
Func Redraw_GUI_GDIp()
Display_Rotated_Text($hWnd, "1. Halbzeit", 6, 373, 90, 800)
Display_Rotated_Text($hWnd, "2. Halbzeit", 506, 319, 270, 800)
If $status > 2 Then Display_Rotated_Text($hWnd, $zeit_puffer1, 54, 372, 90, 800)
If $status > 4 Then Display_Rotated_Text($hWnd, $zeit_puffer2, 458, 345, 270, 800)
If $status > 6 Then Display_Rotated_Text($hWnd, $zeit_puffer3, 54, 337, 90, 800)
If $status > 8 Then Display_Rotated_Text($hWnd, $zeit_puffer4, 458, 310, 270, 800)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap_time, 38, 392, 433, 156)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap_clock, 80, 24, 352, 348)
Return
EndFunc
Func About() ;danke an Authenticity für das Beispiel!
GUISetState(@SW_DISABLE, $hwnd)
If @OSBuild > 3790 Then
Opt("GUIOnEventMode", 0)
Local Const $DTT_GLOWSIZE = 0x00000800, $DTT_TEXTCOLOR = 0x00000001, $DTT_COMPOSITED = 0x00002000, $GDIP_CHOCOLATE = 0xFFD2691E
Local Const $tagDTTOPTS = "uint Size;uint Flags;uint clrText;uint clrBorder;uint clrShadow;int TextShadowType;" & $tagPOINT & _
";int BorderSize;int FontPropId;int ColorPropId;int StateId;int ApplyOverlay;int GlowSize;ptr DrawTextCallback;int lParam;"
$hGUI_About = GUICreate("Über", $iXX, $iYY, -1, -1, $WS_SYSMENU, $WS_EX_TOPMOST)
[/autoit] [autoit][/autoit] [autoit]GUISetState()
[/autoit] [autoit][/autoit] [autoit]$hTheme = _WinAPI_OpenThemeData($hGUI_About, "globals")
[/autoit] [autoit][/autoit] [autoit]$hGraphic_About = _GDIPlus_GraphicsCreateFromHWND($hGUI_About)
$hDC = _GDIPlus_GraphicsGetDC($hGraphic_About)
$hCDC = _WinAPI_CreateCompatibleDC($hDC)
$hBMP_About = _WinAPI_CreateBitmap($iXX, $iYY) ;create a dummy bitmap
$hImage_About = _GDIPlus_BitmapCreateFromHBITMAP($hBMP_About)
$hBitmap_About = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage_About)
$hScrDC = _WinAPI_GetDC(0)
$hDC_backbuffer = _WinAPI_CreateCompatibleDC($hScrDC)
$DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hBitmap_About)
$hBackbuffer_About = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) ;create back buffer bitmap
$tClientRect = _WinAPI_GetClientRect($hGUI_About)
$pClientRect = DllStructGetPtr($tClientRect)
$tBmpInfo = DllStructCreate($tagBITMAPINFO)
DllStructSetData($tBmpInfo, "Size", DllStructGetSize($tBmpInfo) - 4)
DllStructSetData($tBmpInfo, "Width", $iXX)
DllStructSetData($tBmpInfo, "Height", -$iYY)
DllStructSetData($tBmpInfo, "Planes", 1)
DllStructSetData($tBmpInfo, "BitCount", 32)
DllStructSetData($tBmpInfo, "Compression", 0)
$hDIBBmp = _WinAPI_CreateDIBSection($hDC, $tBmpInfo, $pBitmapData)
$hFont_About = _WinAPI_CreateFont($fHigh, $fWidth, $fESC, $fOrient, $fWeight, $fItalic, $fUnderline, $fStrikeout, $fCharset, $fOutputPrec, $fClipPrec, $fQuality, $fPitch, $fFace)
$hOldBmp = _WinAPI_SelectObject($hCDC, $hDIBBmp)
$hOldFont = _WinAPI_SelectObject($hCDC, $hFont_About)
$tDTTOptions = DllStructCreate($tagDTTOPTS)
DllStructSetData($tDTTOptions, "Size", DllStructGetSize($tDTTOptions))
DllStructSetData($tDTTOptions, "Flags", $DTT_GLOWSIZE + $DTT_TEXTCOLOR + $DTT_COMPOSITED)
DllStructSetData($tDTTOptions, "GlowSize", $fGlowsize)
DllStructSetData($tDTTOptions, "clrText", _RGBtoBGR($GDIP_CHOCOLATE))
$pDTTOptions = DllStructGetPtr($tDTTOptions)
_WinAPI_DrawThemeTextEx($hTheme, $hCDC, 0, 0, $atext, $DT_WORD_ELLIPSIS + $DT_WORDBREAK + $DT_CENTER + $DT_NOPREFIX, $pClientRect, $pDTTOptions)
[/autoit] [autoit][/autoit] [autoit]_WinAPI_SelectObject($hCDC, $hOldFont)
_WinAPI_SelectObject($hCDC, $hOldBmp)
_WinAPI_DeleteObject($hFont_About)
_WinAPI_DeleteDC($hCDC)
_GDIPlus_GraphicsReleaseDC($hGraphic_About, $hDC)
$hBrush = _GDIPlus_LineBrushCreate(0, 0, 0, $iYY / 4, 0, 0, 1)
$hbackground = _GDIPlus_BitmapCreateFromGdiDib($tBmpInfo, $pBitmapData)
_GDIPlus_GraphicsDrawImage($hBackbuffer_About, $hbackground, 0, 0)
_GDIPlus_LineBrushSetColors($hBrush, 0x70000000, 0x70D2691E)
_GDIPlus_GraphicsFillRect($hBackbuffer_About, 0, $iYY / 2, $iXX, $iYY, $hBrush)
_WinAPI_BitBlt($hDC, 0, 0, $iXX, $iYY, $hDC_backbuffer, 0, 0, 0x00CC0020)
GUIRegisterMsg($WM_PAINT, "")
GUIRegisterMsg($WM_PAINT, "Redraw_About")
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIRegisterMsg($WM_PAINT, "")
GUIRegisterMsg($WM_PAINT, "Redraw_GUI")
_GDIPlus_ImageDispose($hbackground)
_GDIPlus_GraphicsDispose($hGraphic_About)
_WinAPI_DeleteObject($hDIBBmp)
_WinAPI_CloseThemeData($hTheme)
_WinAPI_DeleteObject($hBMP_About)
_GDIPlus_BitmapDispose($hImage_About)
_WinAPI_DeleteObject($hBitmap_About)
_WinAPI_ReleaseDC(0, $hScrDC)
_WinAPI_SelectObject($hDC_backbuffer, $DC_obj)
_GDIPlus_GraphicsDispose($hBackbuffer_About)
GUIDelete($hGUI_About)
Opt("GUIOnEventMode", 1)
Else
WinSetOnTop($hwnd, "", False)
MsgBox(0, "Über", $titel & $build & @CRLF & @CRLF & $coder)
If BitAND(GUICtrlRead($MenuItem4), $GUI_CHECKED) = $GUI_CHECKED Then WinSetOnTop($hwnd, "", True)
EndIf
GUISetState(@SW_ENABLE, $hwnd)
EndFunc
Func Redraw_About()
Redraw_GUI_GDIp()
_WinAPI_BitBlt($hDC, 0, 0, $iXX, $iYY, $hDC_backbuffer, 0, 0, 0x00CC0020)
EndFunc
Func _RGBtoBGR($iRGB)
Return Dec(StringMid(Binary($iRGB), 3, 6))
EndFunc
Func _WinAPI_OpenThemeData($hWnd, $sClassList)
Local $aResult = DllCall("uxtheme.dll", "hwnd", "OpenThemeData", "hwnd", $hWnd, "wstr", $sClassList)
If @error Then Return SetError(@error, @extended, 0)
Return SetError(0, 0, $aResult[0])
EndFunc
Func _WinAPI_CloseThemeData($hTheme)
Local $aResult = DllCall("uxtheme.dll", "int", "CloseThemeData", "hwnd", $hTheme)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0] = 0
EndFunc
Func _WinAPI_CreateDIBSection($hDC, $tBmpInfo, ByRef $pBits)
Local $pBmpInfo, $aResult
$pBmpInfo = DllStructGetPtr($tBmpInfo)
$aResult = DllCall("gdi32.dll", "hwnd", "CreateDIBSection", "hwnd", $hDC, "ptr", $pBmpInfo, "uint", 0, "int*", 0, "hwnd", 0, "uint", 0)
If @error Then Return SetError(@error, @extended, 0)
If $aResult[0] = 87 Then Return SetError(-1, 0, 0)
If $aResult[0] = 0 Then Return SetError(-2, 0, 0)
$pBits = $aResult[4]
Return SetError(0, 0, $aResult[0])
EndFunc
Func _WinAPI_DrawThemeTextEx($hTheme, $hDC, $iPartId, $iStateId, $sText, $iFlags, $pRect, $pDTTOPTS)
Local $aResult = DllCall("uxtheme.dll", "int", "DrawThemeTextEx", "ptr", $hTheme, "hwnd", $hDC, "int", $iPartId, "int", $iStateId, "wstr", $sText, "int", -1, "uint", $iFlags, "ptr", $pRect, "ptr", $pDTTOPTS)
If @error Then Return SetError(@error, @extended, 0)
Return SetError(0, 0, $aResult[0] = 0)
EndFunc
Func _GDIPlus_BitmapCreateFromGdiDib($tBitmapInfo, $pBitmapData)
Local $pBitmapInfo, $aResult
$pBitmapInfo = DllStructGetPtr($tBitmapInfo)
$aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromGdiDib", "ptr", $pBitmapInfo, "ptr", $pBitmapData, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
$GDIP_STATUS = $aResult[0]
Return $aResult[3]
EndFunc
Func _GDIPlus_LineBrushCreate($nX1, $nY1, $nX2, $nY2, $iARGBClr1, $iARGBClr2, $iWrapMode = 0)
Local $tPointF1, $pPointF1
Local $tPointF2, $pPointF2
Local $aResult
$tPointF1 = DllStructCreate("float;float")
$pPointF1 = DllStructGetPtr($tPointF1)
$tPointF2 = DllStructCreate("float;float")
$pPointF2 = DllStructGetPtr($tPointF2)
DllStructSetData($tPointF1, 1, $nX1)
DllStructSetData($tPointF1, 2, $nY1)
DllStructSetData($tPointF2, 1, $nX2)
DllStructSetData($tPointF2, 2, $nY2)
$aResult = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "ptr", $pPointF1, "ptr", $pPointF2, "uint", $iARGBClr1, "uint", $iARGBClr2, "int", $iWrapMode, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
$GDIP_STATUS = $aResult[0]
Return $aResult[6]
EndFunc
Func _GDIPlus_LineBrushSetColors($hLineGradientBrush, $iARGBStart, $iARGBEnd)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetLineColors", "hwnd", $hLineGradientBrush, "uint", $iARGBStart, "uint", $iARGBEnd)
If @error Then Return SetError(@error, @extended, False)
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc
Func _GDIPlus_PathCreate($iFillMode = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", $iFillMode, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
$GDIP_STATUS = $aResult[0]
Return $aResult[2]
EndFunc
Func _GDIPlus_CustomLineCapCreate($hPathFill, $hPathStroke, $iLineCap = 0, $nBaseInset = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateCustomLineCap", "hwnd", $hPathFill, "hwnd", $hPathStroke, "int", $iLineCap, "float", $nBaseInset, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
$GDIP_STATUS = $aResult[0]
Return $aResult[5]
EndFunc
Func _GDIPlus_CustomLineCapSetStrokeCaps($hCustomLineCap, $iStartCap, $iEndCap)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetCustomLineCapStrokeCaps", "hwnd", $hCustomLineCap, "int", $iStartCap, "int", $iEndCap)
If @error Then Return SetError(@error, @extended, False)
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc
Func _GDIPlus_CustomLineCapGetStrokeCaps($hCustomLineCap)
Local $aCaps[2], $aResult
$aResult = DllCall($ghGDIPDll, "uint", "GdipGetCustomLineCapStrokeCaps", "hwnd", $hCustomLineCap, "int*", 0, "int*", 0)
If @error Then Return SetError(@error, @extended, -1)
$GDIP_STATUS = $aResult[0]
If $GDIP_STATUS Then Return -1
$aCaps[0] = $aResult[2]
$aCaps[1] = $aResult[3]
Return $aCaps
EndFunc
Func _GDIPlus_PenSetLineCap($hPen, $iStartCap, $iEndCap, $iDashCap)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetPenLineCap197819", "hwnd", $hPen, "int", $iStartCap, "int", $iEndCap, "int", $iDashCap)
If @error Then Return SetError(@error, @extended, False)
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc
Func _GDIPlus_PathDispose($hPath)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $hPath)
If @error Then Return SetError(@error, @extended, False)
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc
Einige Dateien werden benötigt, die im 7-Zip Archiv enthalten sind!
Hier ein Screenshot: -=> autoit.de/wcf/attachment/7681/
Ich hoffe, es bring irgend jemanden was (vielleicht das GDI+ Zeug! )
Gruß,
UEZ
Änderungen in v1.1:
* Ini Datei hinzugefügt, damit die Einstellungen gespeichert werden
* großen Zeiger vergrößert und Spitze hinzugefügt
* großer Zeiger verschiebt sich auch auf Sekunden Basis (vorher Minuten Basis)
* Stoppuhr Bild leicht verbessert
* bei Verlängerung nach 15 Minuten rote Darstellung des Kreisdiagramms
* etc.
Änderungen in v1.2:
* wusste gar nicht, dass die Schrift in "Über" unter WinXP nicht angezeigt wird -> Win2003 und kleiner wird jetzt "nur" eine Messagebox angezeigt
* Reset im Menü hinzugefügt, damit man jeder Zeit die Stoppuhr zurück setzen (resetten) kann
Änderungen in v1.3:
* das About Fenster hatte kein Redraw (hab's vergessen) -> Danke an m-obi für den Hinweis
* doppelter Aufruf von GUIRegisterMsg($WM_PAINT, "") -> dadurch kein Repaint auf der Haupt GUI, wenn das "Über" Fenster geöffnet ist (danke SEuBO!)
* kleinere Bugs beseitigt
Änderungen in v1.4:
* "double buffering" des Grafikfensters von "Über" hinzugefügt, damit es nicht so flackert, wenn man es hin und her bewegt
* kleinere Fehler beseitigt