Hi..
Warum löst dieser Gui bei 1. klick auf $button die MsgBox andauernd aus?
orginal ist von Health
Spoiler anzeigen
#cs ----------------------------------------------------------------------------
Author: Health
#ce ----------------------------------------------------------------------------
#include <GuiConstants.au3>
[/autoit] [autoit][/autoit] [autoit]$Title = "Steam Like Window in AutoIt!"
$Width = 400 ; \
$Height = 250 ; - beliebig veränderbar... alle koordinaten von ctrls relativ zur gui-größe
; Konstanten
Global Const $Font = "Tahoma"
Global Const $FontSize = 8.5
Global Const $FontColor = 0xD8DED3
Global Const $FontColor2 = 0xC4B550 ; progress, tab, active
Global Const $FontColorInput = 0xFFFFFF
Global Const $TitleHeight = 21
Global Const $DefaultCtrlHeight = 24
Global Const $BgColorTitle = 0x5A6A50
Global Const $BgColor = 0x464646
Global Const $BgColorInput = 0x555555
Global Const $BgColorButton = 0x555852
Global Const $LineColor = 0x686A65
$Gui = GUICreate($Title, $Width, $Height, -1, -1, $WS_POPUP)
GUISetBkColor($BgColor)
GUISetFont($FontSize, 400, 0, $Font)
; Fenster-Rahmen
; Close-Button
$Close = GUICtrlCreatePic("close.bmp", $Width - 16, 7, 9, 9)
; Minimieren-Button
$Minimize = GUICtrlCreatePic("minimize.bmp", $Width - 31, 7, 9, 9)
; Titel-Label
$TitleBar = GUICtrlCreateLabel($Title, 6, 4, $Width - 42, 17, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetColor(-1, $FontColor)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
; Hintergrund der Titelleiste
GUICtrlCreateGraphic(0, 0, $Width, $TitleHeight)
GUICtrlSetBkColor(-1, $BgColorTitle)
; Eigentlicher Inhalt
GUICtrlCreateLabel("Welcome to Steam...", 15, $TitleHeight + 15, $Width - 30, 20)
GUICtrlSetColor(-1, $FontColor)
GUICtrlCreateLabel("This GUI rocking your ass!", 15, $TitleHeight + 45, $Width - 30, 20)
GUICtrlSetColor(-1, $FontColor2)
$Input = GUICtrlCreateInput("an input", 50, 125, 100, $DefaultCtrlHeight)
GUICtrlSetColor(-1, $FontColorInput)
GUICtrlSetBkColor(-1, $BgColorInput)
$Button = GUICtrlCreateButton("press", 75, 175, 80, $DefaultCtrlHeight + 2)
GUICtrlSetColor(-1, $FontColorInput)
GUICtrlSetBkColor(-1, $BgColorButton)
; Fenster-Rahmen
; Gui-Rand
GUICtrlCreateGraphic(0, $TitleHeight, $Width, $Height - $TitleHeight)
GUICtrlSetBkColor(-1, $LineColor)
GUICtrlCreateGraphic(1, $TitleHeight, $Width - 3, $Height - $TitleHeight - 2)
GUICtrlSetBkColor(-1, $BgColor)
; Gui einblenden
GuiRoundCorners($Gui, 0, 0, 2, 2)
WinSetTrans($Gui, "", 0)
GUISetState()
FadeIn($Gui)
Func GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
$pos = WinGetPos($h_win)
$ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)
If $ret[0] Then
$ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
If $ret2[0] Then
Return 1
Else
Return 0
EndIf
Else
Return 0
EndIf
EndFunc ;==>GuiRoundCorners
Func FadeIn($h)
For $i = 0 To 255 Step 15
Sleep(10)
WinSetTrans($h, "", $i)
Next
EndFunc ;==>FadeIn
Func FadeOut($h)
For $i = 255 To 0 Step -15
Sleep(10)
WinSetTrans($h, "", $i)
Next
EndFunc ;==>FadeOut
Func SetTitle($s)
GUICtrlSetData($TitleBar, $s)
WinSetTitle($Gui, "", $s)
EndFunc
While 1
Switch GUIGetMsg()
Case $Close
FadeOut($Gui)
Exit
Case $Minimize
FadeOut($Gui)
GUISetState(@SW_MINIMIZE)
WinSetTrans($Gui, "", 255)
Case $Button
MsgBox (0,"","")
GUICtrlSetData($Input, "foobar!")
SetTitle("Es ist " & @HOUR & ":" & @MIN & " Uhr und " & @SEC & " Sekunden")
EndSwitch
WEnd
;
; Ende
;
Hoffe das da jemand ne lösung findet...
MFG chris