PNG Button.

  • Geht iwie nicht:

    Fehler:

    Spoiler anzeigen
    Code
    C:\Users\Slash\Desktop\MW2\AutoIt v3 Script (neu).au3 (26) : ==> Variable used without being declared.:
    $btn_min = _GUICtrlPic_Create($min , 465, 6, 14, 14, $SS_CENTERIMAGE + $SS_SUNKEN, Default)
    $btn_min = _GUICtrlPic_Create($min , 465, 6, 14, 14, ^ ERROR

    Mein Code:

    Spoiler anzeigen
  • schon klar ...

    du musst ja auch die Variable deklarieren:
    ersetze die Zeile 16 durch:

    [autoit]

    Local $btn_min = _GUICtrlPic_Create($min , 465, 6, 14, 14, $SS_CENTERIMAGE + $SS_SUNKEN, Default)

    [/autoit]

    MFG Schnacko

    Einmal editiert, zuletzt von Schnacko (20. September 2011 um 18:41)

  • Spoiler anzeigen

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

    AutoIt Version: 3.3.6.1
    Author: myName

    Script Function:
    Template AutoIt script.

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

    Global $MY_GUIIMAGE = 'data\bg.png'
    Global $MY_GUIIMAGE2 = 'data\grey.gif'
    Global $min = "data\min.png"

    #include <GUIConstantsEx.au3>
    #include <UDF_Skin_GUI.au3>
    #include <GUICtrlPic.au3>

    Opt("GUIOnEventMode", 1); Change to OnEvent mode
    HotKeySet('{esc}','CLOSEClicked'); ALT+1 Show / Hode Gui to tray


    #Region ### START Koda GUI section ### Form=
    Global $Form1 = _UDF_SKINGUI_MAKE('MW2')

    Global $btn_min = _GUICtrlPic_Create($min , 465, 6, 14, 14, $SS_CENTERIMAGE + $SS_SUNKEN, Default)

    GUICtrlSetCursor(-1, 0)

    GUISetState(@SW_SHOW)

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    Exit

    ;~ =======================================
    Func CLOSEClicked()
    _UDF_SKINGUI_DELETE($Form1)
    Exit
    EndFunc
    ;~ =======================================
    While 1
    Sleep(1000); Idle around
    WEnd

    So?

  • Jo .. schätz schon..

    funkts?
    Meine Frage: Was soll die While am ende ausrichten? aber egal.. das ist ja wieder was ganz anderes..
    ich würde in die Do-Schleife noch ein Sleep rein machen

  • Spoiler anzeigen

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

    AutoIt Version: 3.3.6.1
    Author: myName

    Script Function:
    Template AutoIt script.

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

    Global $MY_GUIIMAGE = 'data\bg.png'
    Global $MY_GUIIMAGE2 = 'data\grey.gif'
    Global $min = "data\min.png"

    #include <GUIConstantsEx.au3>
    #include <UDF_Skin_GUI.au3>
    #include <GUICtrlPic.au3>

    Opt("GUIOnEventMode", 1); Change to OnEvent mode
    HotKeySet('{esc}','CLOSEClicked'); ALT+1 Show / Hode Gui to tray


    #Region ### START Koda GUI section ### Form=
    Global $Form1 = _UDF_SKINGUI_MAKE('MW2')

    Global $btn_min = _GUICtrlPic_Create($min , 465, 6, 14, 14, $SS_CENTERIMAGE + $SS_SUNKEN, Default)

    GUICtrlSetCursor(-1, 0)

    GUISetState(@SW_SHOW)

    Do
    Sleep(1000)
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    Exit

    ;~ =======================================
    Func CLOSEClicked()
    _UDF_SKINGUI_DELETE($Form1)
    Exit
    EndFunc
    ;~ =======================================

    Will einfach nich funktionieren -.- immer wieder der gleiche fehler =(

  • ich schätz mal:
    $SS_CENTERIMAGE + $SS_SUNKEN
    wird nicht gefunden... diese sollten konstante von der UDF sein.. glaube ich..

  • Geht iwie nicht:

    Fehler:

    Spoiler anzeigen

    C:\Users\Slash\Desktop\MW2\AutoIt v3 Script (neu).au3 (26) : ==> Variable used without being declared.:
    $btn_min = _GUICtrlPic_Create($min , 465, 6, 14, 14, $SS_CENTERIMAGE + $SS_SUNKEN, Default)
    $btn_min = _GUICtrlPic_Create($min , 465, 6, 14, 14, ^ ERROR

    Der Fehler liegt an einer Konstanten die fehlt, wenn du

    [autoit]

    #include <StaticConstants.au3>

    [/autoit]

    einfügst sollte es funktionieren. In solchen Fällen hilf ALT-T Compile => Haken bei Add required Constants *.au3 to your script => Save only und erneut mit F5 starten.

    mfg autoBert

  • Klasse =) es funktioniert. Jedoch legt sich über das gui png eine graue fläche auf der dann der button is. also das gui pic wird nur kurz angezeigt ?

    Dann wende dich an den Author der UDF_Skin_GUI.au3.

    Du kannst aber auch hier in diesen Forum nach Lösungen suchen: UEZ hat schon mehrmals eine gepostet die sowohl unter XP, Vusta und Win/ funktioniert,

    mfg autoBert

  • Hab da mal ne Funktion von Seubo rausgekramt, ich find die recht praktisch. :)

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <WindowsConstants.au3>
    #include <GuiConstantsEx.au3>

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

    InetGet("http://upload.wikimedia.org/wikipedia/commons/7/7a/Basketball.png",@ScriptDir & "\Ball.png")

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

    Opt('GUIOnEventMode', 1)

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

    $hGUI = GUICreate("",350,350); Gui elemte ausblenden
    GUISetOnEvent(-3,"_Exit")
    GUISetBkColor(0xFF7F24)
    $guibk = GUICtrLCreatePng($hGUI,@ScriptDir & "\Ball.png",20,20)
    GUICtrlSetOnEvent(-1,"_Basketfunc")

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

    GUISetState(@SW_SHOW)

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

    While Sleep(50)
    WEnd

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

    Func GUICtrlCreatePng($hWnd, $sPath, $iX, $iY) ; SEuBo
    _GDIPlus_Startup()
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend, $hGUI
    Local $hImage = _GDIPlus_ImageLoadFromFile($sPath), $iWidth = _GDIPlus_ImageGetWidth($hImage), $iHeight = _GDIPlus_ImageGetHeight($hImage)
    $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]

    Func _Basketfunc()
    MsgBox(0,"","Du hast den Ball angeklickt!")
    EndFunc

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

    Func _Exit()
    Exit
    EndFunc

    [/autoit]

    MfG hellboy

    [autoit]

    Do
    _help($user)
    Until $questions = 0

    [/autoit]

    Meine Werke:
    Ste`s Web-Radio