Problem mit meiner GUI

  • Tag,
    das Problem liegt darin , dass wenn man auf Enter drück das Fenster verschwinden soll.
    Das tut es auch , nur der Header wird noch angezeigt .... Warum ? :(

    Script:

    [autoit]


    #cs ----------------------------------------------------------------------------

    [/autoit][autoit][/autoit][autoit]

    AutoIt Version: 3.3.6.1
    Author: Marcel B.

    [/autoit][autoit][/autoit][autoit]

    Script Function:
    Template AutoIt script.

    [/autoit][autoit][/autoit][autoit]

    #ce ----------------------------------------------------------------------------

    [/autoit][autoit][/autoit][autoit]

    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <EditConstants.au3>
    #include <ButtonConstants.au3>
    #include <GDIPlus.au3>
    #include <WindowsConstants.au3>
    #include <GuiConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <FTPEx.au3>
    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiComboBox.au3>
    #include <StaticConstants.au3>
    #include <Array.au3>

    [/autoit][autoit][/autoit][autoit]

    #Region ### START Koda GUI section ### Form=

    [/autoit][autoit][/autoit][autoit]

    ;~ $Pic1 = GUICtrlCreatePic("background.jpg", 0, 0, 751, 523)
    ;~ GUICtrlSetState(-1, $GUI_DISABLE)
    Opt ('GUIOnEventMode', 1)
    $WinMain = GUICreate("Form1", 705, 523, 283, 74)
    GUISetOnEvent ($GUI_EVENT_CLOSE, '_LoginExit')
    $Pic1 = GUICtrlCreatePic("bg3.jpg", 0, 0,705, 523)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreatePng($WinMain, "headerhbulm.png", -10, 0)
    $Label3 = GUICtrlCreateLabel(" Benutzername:", 130, 220, 120, 26, $SS_CENTER)
    GUICtrlSetFont(-1, 11, 800, 0, "Arial Black")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    $Label1 = GUICtrlCreateLabel("Probleme beim Einloggen ?", 157, 320, 132, 17)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0x000080)
    $Label11 = GUICtrlCreateLabel("Datenschutzbestimmungen", 20, 488, 132, 17)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0x000080)
    $Label111 = GUICtrlCreateLabel("", 160, 488, 132, 17)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0x000080)
    ;~ $Label4 = GUICtrlCreateLabel("Datenschutzbestimmungen", 0, 504, 132, 17)
    ;~ GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    ;~ GUICtrlSetColor(-1, 0x000080)
    $Label2 = GUICtrlCreateLabel("Willkommen im Control Center", 80, 98, 611, 27)
    GUICtrlSetFont(-1, 12, 800, 0, "Arial Black")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    $Label5 = GUICtrlCreateLabel("Kennwort:", 130, 270, 90, 26, $SS_CENTER)
    GUICtrlSetFont(-1, 11, 800, 0, "Arial Black")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    $Input2 = GUICtrlCreateInput("Kennwort", 138, 288, 145, 28, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Input3 = GUICtrlCreateInput("Name", 138, 240, 145, 28)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    ;~ GUICtrlSetColor(-1, 0x000080)
    $Link = GUICtrlCreateLabel("www.LS-Roleplay.com", 160, 488, 374, 18)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0x000080)
    $Link = GUICtrlCreateLabel("Copyright", 279, 488, 374, 18)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0x000080)
    $LoginNow = GUICtrlCreateButton("Login", -280, -88, 75, 25, $BS_DEFPUSHBUTTON)
    GUICtrlSetOnEvent($LoginNow,"_Login")
    GUISetState(@SW_SHOW)
    ;~ GUICtrlSetData(@SW_HIDE,$hGUI )
    #EndRegion ### END Koda GUI section ###

    [/autoit][autoit][/autoit][autoit]

    LoadCursor("1.cur", $WinMain)
    LoadCursor("2.cur", GUICtrlGetHandle($Input2))
    LoadCursor("3.cur", GUICtrlGetHandle($Label1))

    [/autoit][autoit][/autoit][autoit]

    While 1
    Sleep(50)
    WEnd

    [/autoit][autoit][/autoit][autoit]

    Func _LoginExit()
    Exit
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func _Login()
    GUISetState(@SW_HIDE,$WinMain)
    GUICtrlSetData(@SW_HIDE,$hGUI )
    MsgBox(0,"","Hier wird einmal das Hauptmenu sein."&@CRLF&"Aber der Header ist immernoch zu sehen :(")
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func LoadCursor($szFileName, $hGuiX)
    $hCursor = DllCall("user32.dll", "hwnd", "LoadCursorFromFile", "str", $szFileName)
    $hCursor = $hCursor[0]
    If $hCursor <> 0 Then DllCall("user32.dll", "hwnd", "SetClassLong", "hwnd", $hGuiX, "int", -12, "hwnd", $hCursor)
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func GUICtrlCreatePng($hWnd, $sPath, $iX, $iY) ; SEuBo
    _GDIPlus_Startup()
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    Local $hImage = _GDIPlus_ImageLoadFromFile($sPath), $iWidth = _GDIPlus_ImageGetWidth($hImage), $iHeight = _GDIPlus_ImageGetHeight($hImage)
    Global $hGUI = GUICreate("", $iWidth, $iHeight, $iX, $iY, 0x80000000, BitOR(0x40, 0x80000), $hWnd)
    $cLabel = GUICtrlCreateLabel("", 0, 0, $iWidth, $iHeight)
    GUICtrlSetBkColor(-1, -2)
    GUISetState(@SW_SHOWNOACTIVATE, $hGUI)
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate("int X;int Y")
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $iWidth)
    DllStructSetData($tSize, "Y", $iHeight)
    $tSource = DllStructCreate("int X;int Y")
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate("byte Op;byte Flags;byte Alpha;byte Format")
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", 255)
    DllStructSetData($tBlend, "Format", 1)
    _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)
    GUISwitch($hWnd)
    _GDIPlus_ImageDispose($hImage)
    ;_GDIPlus_Shutdown()
    Return SetError(0, $hGUI, $cLabel)
    EndFunc ;==>GUICtrlCreatePng

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit]

    Winrar Datei mit den Bildern und Source:
    http://www.workupload.com/file/0wOADBc

  • Wo wird denn da der Header angezeigt? Ich seh da nichts ..

    2te Frage wieso eigentlich

    [autoit]

    GUICtrlSetData(@SW_HIDE,$hGUI )

    [/autoit]

    statt GUIsetstate() ?!

    PS: ich weiß das hilft dir nicht weiter, aber es interessiert mich ;)

  • Das Hilft mir sehr wohl weiter , jetzt gehts nämlich xD

    Ach ja und wenn du dir den Ordner Runterlädst siehst du auch den Header D:

  • Hallo derBrot,

    ich würde dafür die GUICtrlPic.au3 von Großvater verwenden. Dein Skript sähe dann so aus:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    AutoIt Version: 3.3.6.1
    Author: Marcel B.

    [/autoit] [autoit][/autoit] [autoit]

    Script Function:
    Template AutoIt script.

    [/autoit] [autoit][/autoit] [autoit]

    #ce ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <EditConstants.au3>
    #include <ButtonConstants.au3>
    #include <GDIPlus.au3>
    #include <WindowsConstants.au3>
    #include <GuiConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <FTPEx.au3>
    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiComboBox.au3>
    #include <StaticConstants.au3>
    #include <Array.au3>
    #include <GUICtrlPic.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=

    [/autoit] [autoit][/autoit] [autoit]

    ;~ $Pic1 = GUICtrlCreatePic("background.jpg", 0, 0, 751, 523)
    ;~ GUICtrlSetState(-1, $GUI_DISABLE)
    Opt('GUIOnEventMode', 1)
    $WinMain = GUICreate("Form1", 705, 523, 283, 74)
    GUISetOnEvent($GUI_EVENT_CLOSE, '_LoginExit')
    $Pic1 = GUICtrlCreatePic("bg3.jpg", 0, 0, 705, 523)
    GUICtrlSetState(-1, $GUI_DISABLE)
    _GUICtrlPic_Create("headerhbulm.png", -10, 0)
    $Label3 = GUICtrlCreateLabel(" Benutzername:", 130, 220, 120, 26, $SS_CENTER)
    GUICtrlSetFont(-1, 11, 800, 0, "Arial Black")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    $Label1 = GUICtrlCreateLabel("Probleme beim Einloggen ?", 157, 320, 132, 17)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0x000080)
    $Label11 = GUICtrlCreateLabel("Datenschutzbestimmungen", 20, 488, 132, 17)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0x000080)
    $Label111 = GUICtrlCreateLabel("", 160, 488, 132, 17)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0x000080)
    ;~ $Label4 = GUICtrlCreateLabel("Datenschutzbestimmungen", 0, 504, 132, 17)
    ;~ GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    ;~ GUICtrlSetColor(-1, 0x000080)
    $Label2 = GUICtrlCreateLabel("Willkommen im Control Center", 80, 98, 611, 27)
    GUICtrlSetFont(-1, 12, 800, 0, "Arial Black")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    $Label5 = GUICtrlCreateLabel("Kennwort:", 130, 270, 90, 26, $SS_CENTER)
    GUICtrlSetFont(-1, 11, 800, 0, "Arial Black")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    $Input2 = GUICtrlCreateInput("Kennwort", 138, 288, 145, 28, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD))
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Input3 = GUICtrlCreateInput("Name", 138, 240, 145, 28)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    ;~ GUICtrlSetColor(-1, 0x000080)
    $Link = GUICtrlCreateLabel("www.LS-Roleplay.com", 160, 488, 374, 18)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0x000080)
    $Link = GUICtrlCreateLabel("Copyright", 279, 488, 374, 18)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0x000080)
    $LoginNow = GUICtrlCreateButton("Login", -280, -88, 75, 25, $BS_DEFPUSHBUTTON)
    GUICtrlSetOnEvent($LoginNow, "_Login")
    GUISetState(@SW_SHOW)
    ;~ GUICtrlSetData(@SW_HIDE,$hGUI )
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    LoadCursor("1.cur", $WinMain)
    LoadCursor("2.cur", GUICtrlGetHandle($Input2))
    LoadCursor("3.cur", GUICtrlGetHandle($Label1))

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(50)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _LoginExit()
    Exit
    EndFunc ;==>_LoginExit

    [/autoit] [autoit][/autoit] [autoit]

    Func _Login()
    GUISetState(@SW_HIDE, $WinMain)
    ;GUICtrlSetData(@SW_HIDE,$hGUI )
    MsgBox(0, "", "Hier wird einmal das Hauptmenu sein.")
    EndFunc ;==>_Login

    [/autoit] [autoit][/autoit] [autoit]

    Func LoadCursor($szFileName, $hGuiX)
    $hCursor = DllCall("user32.dll", "hwnd", "LoadCursorFromFile", "str", $szFileName)
    $hCursor = $hCursor[0]
    If $hCursor <> 0 Then DllCall("user32.dll", "hwnd", "SetClassLong", "hwnd", $hGuiX, "int", -12, "hwnd", $hCursor)
    EndFunc ;==>LoadCursor

    [/autoit]

    mfg autoBert

    • Offizieller Beitrag

    Das Hilft mir sehr wohl weiter , jetzt gehts nämlich xD

    Ach ja und wenn du dir den Ordner Runterlädst siehst du auch den Header D:

    [OT]
    Made my Day. :rofl:
    GUICtrlSetData(@SW_HIDE,$hGUI ) bedeutest das du dem Control @SW_HIDE also 0 den Winhandle deiner GUI als Daten gibst. :D
    Ist absolut sinnfrei, sieht aber gut aus :whistling:
    [/OT]
    Auch wenn das ein Post der Kategorie Spam ist, ich konnte einfach nicht an mir halten.