[GDI+] Programmumschaltungs(Alt-Tab)-GUI nachprogrammieren

  • Hallo!
    Ich würde gern die GUI vom Win7-Aero-Alt-Tab-Programmumschalter nachbauen, um eigene Icons (zum wechseln zwischen Funktionen meines Fußpedals, falls das jemand mitbekommen hat) draufzuhauen.
    Bisher habe ich nur die klassische ApplyGlass () Funktion gefunden, welche leider Probleme mit der Darstellung von Controls hat, sowie eine GDI+Funktion, welche ich nicht durchschauen kann.
    Ich würde mich sehr über eure Hilfe freuen, wenn sich jemand mit der Materie auskennt.
    Im Grunde will ich also auf einer Aero-GUI Controls malen können. Mit einem Beispielskript wäre mir sehr geholfen.
    liebe grüße!

    Skripte
    ApplyGlass() - Autor verloren
    [autoit]


    #include <StructureConstants.au3>
    #include <GUIConstants.au3>

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

    $GUI = GUICreate("Windows Vista DWM", 243, 243)
    $Apply = GUICtrlCreateButton("Apply", 80, 104, 83, 25, 0)
    GUISetState(@SW_SHOW)

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

    While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Apply
    $Ret = ApplyGlass($GUI,243,243,243,243,0x000000); produces full glass window, the glass is red colored
    EndSwitch
    WEnd

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

    Func ApplyGlass($hWnd,$leftw,$rightw,$toph,$bottomh,$glasscolor = "0x000000")
    $struct=DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;")
    DllStructSetData($struct,"cxLeftWidth",$leftw)
    DllStructSetData($struct,"cxRightWidth",$rightw)
    DllStructSetData($struct,"cyTopHeight",$toph)
    DllStructSetData($struct,"cyBottomHeight",$bottomh)
    GUISetBkColor($glasscolor)
    Return DllCall("dwmapi.dll", "int", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($struct))
    EndFunc

    [/autoit]
    GDI-Skript

    http://www.autoitscript.com/forum/topic/13…-menu-estetics/

    [autoit]

    #region parts that are not my work:
    ;JamesBrooks for Vista glass functions: http://www.autoitscript.com/forum/topic/..…ions/page__hl__
    ;Authenticity and Yashied for glow txt on glass: http://www.autoitscript.com/forum/topic/..…owing-text-on-a
    ;Malkey for GDI+ gradient: http://www.autoitscript.com/forum/topic/75…ent-line-brush/
    #endregion

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

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

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

    OnAutoItExitRegister( "_CleanUp" )

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

    Global $IconSize = 48
    Global $width = 300
    Global $height = 350
    Global $shine1 = 5
    Global $shine2 = 5
    Global $shine3 = 125
    Global $menuFontSize = 16
    Global $title = 'Some cool menu'
    Global $temp_image = @TempDir & '\my_seven_image.bmp'
    Global $Win_Back_Color = 0x636363;0xC5C5C5;454545 <--- color of lower dark grey line
    For $i = 1 to Int($IconSize/4.8) ;adding space in front of the title so that it doesn't overlap top left image
    $title = ' ' & $title
    Next

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

    #region values requires for text shine on glass area
    Global Const $DTT_TEXTCOLOR = 0x00000001
    Global Const $DTT_GLOWSIZE = 0x00000800
    Global Const $DTT_COMPOSITED = 0x00002000
    If Not IsDeclared("tagDTTOPTS") Then Global 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;"
    Global $Struct = DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;")
    Global $sStruct = DllStructCreate("dword;int;ptr;int")
    Global $Area[4] = [0, 0, $IconSize-23, 0]
    #endregion

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

    Global $Form1 = GUICreate($title, $width, $height, -1, -1, -1, -1)
    Global $GlassArea = GUICtrlCreateLabel("", 0, 0, $width, $IconSize-23) ;area that will be filled with glass
    GUICtrlSetBkColor(-1, 0x000000)
    Global $DarkGreyArea = GUICtrlCreateGraphic(0, 0, $width, $height-45) ;work area (to add controls in)
    GUICtrlSetBkColor(-1, 0xC5C5C5) ;with light grey area
    Global $CloseButton = GUICtrlCreateButton("Close", $width-90, $height-35, 80, 25)
    Global $hTheme = _WinAPI_OpenThemeData($Form1, "globals") ;required function for label shine in glass area
    If (@OSVersion <> "WIN_VISTA") OR (@OSVersion <> "WIN_7") Then _Vista_ApplyGlassArea($Form1, $Area, $Win_Back_Color) ;applying glass area to main GUI (area where $GlassArea label is)

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

    GUISetState(@SW_SHOW, $Form1)

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

    ;creating child GUI with top left image-menu-control
    Global $iX = 0, $iY = 0, $iWidth = $IconSize, $iHeight = $IconSize
    Global $controlGui, $HoverImage, $Mask, $FileGUI, $FileMenu, $EditGUI, $EditMenu, $HelpGUI, $HelpMenu, $DownGUI, $DownMenu

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

    #region create fake GUIs with each holding a clickable control
    $ImageState = 1
    _CreateFakeGUI($controlGui, 'ControlGUI', 48, 48, -1, -23, 1, $HoverImage)
    $FileState = 1
    _CreateFakeGUI($FileGUI, 'FileGUI', 35, $menuFontSize*2-Round($menuFontSize/1.5), 52, 4, 2, $FileMenu)
    $EditState = 1
    _CreateFakeGUI($EditGUI, 'EditGUI', 35, $menuFontSize*2-Round($menuFontSize/1.5), 92, 4, 2, $EditMenu)
    $HelpState = 1
    _CreateFakeGUI($HelpGUI, 'HelpGUI', 45, $menuFontSize*2-Round($menuFontSize/1.5), 130, 4, 2, $HelpMenu)
    $DownState = 1
    _CreateFakeGUI($DownGUI, 'DownGUI', 20, $menuFontSize*2-Round($menuFontSize/1.5), $width-18, 4, 2, $DownMenu)
    #endregion

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

    #region create context menus
    ;----------Image Menu------------------------
    $ImageDummy = GUICtrlCreateDummy()
    $ImageContext = GUICtrlCreateContextMenu($ImageDummy)
    $ImMinimize = GUICtrlCreateMenuItem("Minimize", $ImageContext)
    $ImMaximize = GUICtrlCreateMenuItem("Maximize", $ImageContext)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreateMenuItem("", $ImageContext)
    $imExit = GUICtrlCreateMenuItem("Exit", $ImageContext)
    ;----------File Menu------------------------
    $FileDummy = GUICtrlCreateDummy()
    $FileContext = GUICtrlCreateContextMenu($FileDummy)
    $FileNew = GUICtrlCreateMenu("New", $FileContext)
    $FileNewProject = GUICtrlCreateMenuItem("Project", $FileNew)
    $FileNewFile = GUICtrlCreateMenuItem("File", $FileNew)
    $FileOpen = GUICtrlCreateMenuItem("Open", $FileContext)
    $FileSave = GUICtrlCreateMenuItem("Save", $FileContext)
    $FileSaveAs = guictrlcreatemenuitem("Save As...", $FileContext)
    GUICtrlCreateMenuItem("", $FileContext)
    $FileExit = guictrlcreatemenuitem("Exit", $FileContext)
    ;----------Edit Menu------------------------
    $EditDummy = GUICtrlCreateDummy()
    $EditContext = GUICtrlCreateContextMenu($EditDummy)
    $EditUndo = GUICtrlCreateMenuItem("Undo", $EditContext)
    $EditRedo = GUICtrlCreateMenuItem("Redo", $EditContext)
    GUICtrlCreateMenuItem("", $EditContext)
    $EditCut = GUICtrlCreateMenuItem("Cut", $EditContext)
    $EditCopy = GUICtrlCreateMenuItem("Copy", $EditContext)
    $EditPaste = GUICtrlCreateMenuItem("Paste", $EditContext)
    GUICtrlCreateMenuItem("", $EditContext)
    $EditPref = GUICtrlCreateMenuItem("Preferences", $EditContext)
    ;----------Help Menu------------------------
    $HelpDummy = GUICtrlCreateDummy()
    $HelpContext = GUICtrlCreateContextMenu($HelpDummy)
    $HelpHelp = GUICtrlCreateMenuItem("Help", $HelpContext)
    GUICtrlCreateMenuItem("", $HelpContext)
    $HelpAbout = GUICtrlCreateMenuItem("About", $HelpContext)
    ;----------Down arrow Menu------------------------
    $DownDummy = GUICtrlCreateDummy()
    $DownContext = GUICtrlCreateContextMenu($DownDummy)
    $DownTab = GUICtrlCreateMenuItem("Tab Groups", $DownContext)
    $DownTabOther = GUICtrlCreateMenuItem("Tabs from other computers", $DownContext)
    GUICtrlCreateMenuItem("", $DownContext)
    $DownTabExample = GUICtrlCreateMenuItem("Example tab", $DownContext)
    #endregion

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

    _Draw_menus() ;drawing all menu items

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

    Global $Mask = GUICreate('Mask', $iWidth-2, $iHeight-2, 0, -22, $WS_POPUP, $WS_EX_MDICHILD, $Form1) ;another child window for shade and gloss when moving mouse over image-menu or clicking it
    GUISetBkColor(0xFFFFFF, $Mask)
    WinSetTrans($Mask, '', 40)
    GUISetState(@SW_DISABLE, $Mask) ;still not shown, only disabled

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

    GUIRegisterMsg(0xF,"MY_PAINT")

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

    While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
    Case $HelpAbout
    MsgBox(48, 'About', 'Cool menus by... sandin' & @CRLF & @CRLF & '07.07.2011', -1, $Form1)
    Case $ImMinimize
    WinSetState($Form1, '', @SW_MINIMIZE)
    Case $GUI_EVENT_CLOSE, $imExit, $CloseButton, $FileExit
    Exit
    Case $GlassArea ;moving window when holding glass area that isn't menu
    dllcall("user32.dll","int","SendMessage","hWnd", $Form1,"int",0xA1,"int", 2,"int", 0)
    EndSwitch
    #region detection clicks and hovering above menu items
    If WinActive($Form1) then ;<-- here's one problem, I need this in order for window not to detect any clicks if you click on another window that is above this one
    ;but then you can't click on any control even if the window is aside your currently active window.
    _MenuBehavior($FileGUI, $FileMenu, $FileState, 'File', $FileContext)
    _MenuBehavior($EditGUI, $EditMenu, $EditState, 'Edit', $EditContext)
    _MenuBehavior($HelpGUI, $HelpMenu, $HelpState, 'Help', $HelpContext)
    _MenuBehavior($DownGUI, $DownMenu, $DownState, ChrW(9660), $DownContext)
    _MenuBehavior($controlGui, $HoverImage, $ImageState, '', $ImageContext)
    EndIf
    #endregion
    WEnd

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

    Func _MenuBehavior($WinHWND, $i_MenuItem, ByRef $i_MenuState, $i_Label, $i_ContextMenu);, $i_Shine1, $i_Shine2, $i_Shine3, $i_Color1, $i_Color2)
    Local $a = GUIGetCursorInfo($WinHWND)
    Switch $a[4]
    Case $i_MenuItem
    If $a[2] = 1 Then
    If $i_MenuState <> 3 Then
    $i_MenuState = 3
    if ($FileState <> 1) AND ($FileMenu <> $i_MenuItem) then
    $FileState = 1
    _Draw_Menu_ex($FileGUI, 'File', $menuFontSize, $shine3, 0x000000)
    EndIf
    if ($EditState <> 1) AND ($EditMenu <> $i_MenuItem) then ;making sure that disable all other menu clicked state (if there are any)
    $EditState = 1
    _Draw_Menu_ex($EditGUI, 'Edit', $menuFontSize, $shine3, 0x000000)
    EndIf
    if ($HelpState <> 1) AND ($HelpMenu <> $i_MenuItem) Then
    $HelpState = 1
    _Draw_Menu_ex($HelpGUI, 'Help', $menuFontSize, $shine3, 0x000000)
    EndIf
    if ($DownState <> 1) AND ($DownMenu <> $i_MenuItem) Then
    $DownState = 1
    _Draw_Menu_ex($DownGUI, ChrW(9660), $menuFontSize-Round(Sqrt($menuFontSize)), $shine3, 0x555555)
    EndIf
    if ($ImageState <> 1) AND ($HoverImage <> $i_MenuItem) Then
    $ImageState = 1
    GUISetState(@SW_HIDE, $Mask)
    EndIf
    If $i_MenuItem = $DownMenu then
    _Draw_Menu_ex($WinHWND, ChrW(9660), $menuFontSize-Round(Sqrt($menuFontSize)), $shine2+2, 0x000099)
    ElseIf $i_MenuItem = $HoverImage Then
    GUISetBkColor(0x000000, $Mask)
    GUISetState(@SW_SHOWNOACTIVATE, $Mask)
    Else
    _Draw_Menu_ex($WinHWND, $i_Label, $menuFontSize, $shine1, 0x000099) ;clicked File menu state, drawing average glow, and red color
    EndIf
    ShowMenu($WinHWND, $i_MenuItem, $i_ContextMenu) ;showing context menu for File
    EndIf
    Else
    If $i_MenuState <> 2 Then
    $i_MenuState = 2
    If $i_MenuItem = $DownMenu Then
    _Draw_Menu_ex($WinHWND, '| ' & ChrW(9660) & ' |', $menuFontSize-Round(Sqrt($menuFontSize)), $shine2, 0x555555)
    ElseIf $i_MenuItem = $HoverImage Then
    GUISetBkColor(0xFFFFFF, $Mask)
    GUISetState(@SW_SHOWNOACTIVATE, $Mask)
    Else
    _Draw_Menu_ex($WinHWND, $i_Label, $menuFontSize, $shine2, 0x000000) ;high glow, black color
    EndIf
    EndIf
    EndIf
    Case Else
    If $i_MenuState <> 1 Then
    $i_MenuState = 1
    If $i_MenuItem = $DownMenu Then
    _Draw_Menu_ex($WinHWND, ChrW(9660), $menuFontSize-Round(Sqrt($menuFontSize)), $shine3, 0x555555)
    ElseIf $i_MenuItem = $HoverImage Then
    GUISetState(@SW_HIDE, $Mask)
    Else
    _Draw_Menu_ex($WinHWND, $i_Label, $menuFontSize, $shine3, 0x000000) ;spread glow so there aren't any, black color
    EndIf
    EndIf
    EndSwitch
    EndFunc

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

    Func _CreateFakeGUI(ByRef $WinHWND, $WinTitle, $WinWIdth, $WinHeight, $Win_X, $Win_Y, $AddCtrl, ByRef $CtrlHWND);, $LabelSize = 35)
    $WinHWND = GUICreate($WinTitle, $WinWIdth, $WinHeight, $Win_X, $Win_Y, $WS_POPUP, $WS_EX_MDICHILD, $Form1)
    If $AddCtrl = 1 then
    $CtrlHWND = GUICtrlCreatePic('', 0, 0, $iWidth, $iHeight) ;control to put image later on
    ElseIf $AddCtrl = 2 Then
    $CtrlHWND = GUICtrlCreateLabel('', 0, 0, $WinWIdth, $menuFontSize*2-Round($menuFontSize/1.5)) ;clickable area
    GUICtrlSetBkColor(-1, 0x000000)
    If (@OSVersion <> "WIN_VISTA") OR (@OSVersion <> "WIN_7") Then _Vista_ApplyGlass($WinHWND, $Win_Back_Color) ;apply glass on entire child window
    EndIf
    GUISetState(@SW_DISABLE, $WinHWND) ;disabling window so that it doesn't take focus from parent when you click on it
    GUISetState(@SW_SHOWNOACTIVATE, $WinHWND) ;show and doesn't focus
    If $AddCtrl = 1 Then
    _Create_7Image() ;creating image with 7 number on it (like win7)
    GUICtrlSetImage($CtrlHWND, $temp_image) ;setting image into control we created earlier.
    ;Why did I use this method and not redrew image 7 in MY_PAINT? because it would be very slow, this method is faster.
    EndIf
    EndFunc

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

    Func ShowMenu($hWnd, $CtrlID, $nContextID)
    Local $timez = TimerInit()
    Local $arPos, $x, $y
    Local $hMenu = GUICtrlGetHandle($nContextID)

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

    $arPos = ControlGetPos($hWnd, "", $CtrlID)

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

    $x = $arPos[0]
    $y = $arPos[1] + $arPos[3]

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

    ClientToScreen($hWnd, $x, $y)
    TrackPopupMenu($hWnd, $hMenu, $x, $y)

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

    EndFunc ;==>ShowMenu

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

    Func ClientToScreen($hWnd, ByRef $x, ByRef $y)
    Local $stPoint = DllStructCreate("int;int")

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

    DllStructSetData($stPoint, 1, $x)
    DllStructSetData($stPoint, 2, $y)

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

    DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint))

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

    $x = DllStructGetData($stPoint, 1)
    $y = DllStructGetData($stPoint, 2)
    $stPoint = 0
    EndFunc ;==>ClientToScreen

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

    Func TrackPopupMenu($hWnd, $hMenu, $x, $y)
    DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0)
    EndFunc ;==>TrackPopupMenu

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

    #region glass functions for aero graphic environment (link at the top of the script)
    Func _Vista_ApplyGlass($hWnd, $bColor = 0x000000)
    GUISetBkColor($bColor)
    $Ret = DllCall("dwmapi.dll", "long", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "long*", DllStructGetPtr($Struct))
    If @error Then
    Return 0
    SetError(1)
    Else
    Return $Ret
    EndIf
    EndFunc ;==>_Vista_ApplyGlass

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

    Func _Vista_ApplyGlassArea($hWnd, $Area, $bColor = 0x000000)
    If IsArray($Area) Then
    DllStructSetData($Struct, "cxLeftWidth", $Area[0])
    DllStructSetData($Struct, "cxRightWidth", $Area[1])
    DllStructSetData($Struct, "cyTopHeight", $Area[2])
    DllStructSetData($Struct, "cyBottomHeight", $Area[3])
    GUISetBkColor($bColor); Must be here!
    $Ret = DllCall("dwmapi.dll", "long*", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($Struct))
    If @error Then
    Return 0
    Else
    Return $Ret
    EndIf
    Else
    MsgBox(16, "_Vista_ApplyGlassArea", "Area specified is not an array!")
    EndIf
    EndFunc ;==>_Vista_ApplyGlassArea
    #endregion

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

    Func _Draw_menus()
    _Draw_Menu_ex($FileGUI, 'File', $menuFontSize, $shine3, 0x000000)
    _Draw_Menu_ex($EditGUI, 'Edit', $menuFontSize, $shine3, 0x000000)
    _Draw_Menu_ex($HelpGUI, 'Help', $menuFontSize, $shine3, 0x000000)
    _Draw_Menu_ex($DownGUI, ChrW(9660), $menuFontSize-Round(Sqrt($menuFontSize)), $shine3, 0x555555)
    EndFunc

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

    Func _Draw_Menu_ex($WinHandle, $iCaption, $iSize, $iShine, $iColor)
    Local $hDC = _WinAPI_GetDC($WinHandle)
    Local $tClientRect = _WinAPI_GetClientRect($WinHandle)
    Local $sText = $iCaption
    Local $hFont = _WinAPI_CreateFont($iSize, $iSize/2-1, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _
    $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'SegoeUI')
    _DrawGlowingText($hDC, $sText, $tClientRect, $iShine, $hFont, $iColor)
    _WinAPI_DeleteObject($hFont)
    _WinAPI_ReleaseDC($WinHandle, $hDC)
    EndFunc

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

    #region making label shine in glass area (Link at the top of the script)
    Func _DrawGlowingText($hDC, $sText, $tRc, $iGlowSize = 10, $hFont = 0, $iTextClr = -1)
    Local $hCDC
    Local $hBrush, $hOldBrush
    Local $tRcText
    Local $tBI, $tDTO
    Local $hDIBBmp, $hOldBmp
    Local $hOldFont
    Local $tST
    Local $iFlags = BitOR($DTT_GLOWSIZE, $DTT_COMPOSITED)

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

    $hCDC = _WinAPI_CreateCompatibleDC($hDC)

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

    $tBI = DllStructCreate($tagBITMAPINFO)
    DllStructSetData($tBI, "Size", DllStructGetSize($tBI)-4)
    DllStructSetData($tBI, "Width", DllStructGetData($tRc, "Right")-DllStructGetData($tRc, "Left"))
    DllStructSetData($tBI, "Height", -(DllStructGetData($tRc, "Bottom")-DllStructGetData($tRc, "Top")))
    DllStructSetData($tBI, "Planes", 1)
    DllStructSetData($tBI, "BitCount", 32)
    DllStructSetData($tBI, "Compression", 0) ; BI_RGB

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

    $hDIBBmp = _WinAPI_CreateDIBSection($hDC, $tBI)
    $hOldBmp = _WinAPI_SelectObject($hCDC, $hDIBBmp)
    If $hFont Then $hOldFont = _WinAPI_SelectObject($hCDC, $hFont)

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

    $tDTO = DllStructCreate($tagDTTOPTS)
    DllStructSetData($tDTO, "Size", DllStructGetSize($tDTO))

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

    If $iTextClr <> -1 Then
    $iFlags = BitOR($iFlags, $DTT_TEXTCOLOR)
    DllStructSetData($tDTO, "clrText", $iTextClr)
    EndIf

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

    DllStructSetData($tDTO, "Flags", $iFlags)
    DllStructSetData($tDTO, "GlowSize", $iGlowSize)

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

    _WinAPI_DrawThemeTextEx($hTheme, $hCDC, 0, 0, $sText, _
    BitOR($DT_SINGLELINE, $DT_CENTER, $DT_VCENTER, $DT_NOPREFIX), $tRc, $tDTO)

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

    _WinAPI_BitBlt($hDC, DllStructGetData($tRc, "Left"), DllStructGetData($tRc, "Top"), _
    DllStructGetData($tRc, "Right")-DllStructGetData($tRc, "Left"), _
    DllStructGetData($tRc, "Bottom")-DllStructGetData($tRc, "Top"), $hCDC, 0, 0, 0xCC0020) ; SRCCOPY ;top+Sqrt($menuFontSize)

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

    _WinAPI_SelectObject($hCDC, $hOldBmp)
    If $hFont Then _WinAPI_SelectObject($hCDC, $hOldFont)
    _WinAPI_DeleteObject($hDIBBmp)
    _WinAPI_DeleteDC($hCDC)
    EndFunc

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

    Func _WinAPI_CreateDIBSection($hDC, Const ByRef $tBmpInfo, $iUsage = 0, $pBits = 0, $hSecond = 0, $iOffset = 0)
    Local $aResult = DllCall("gdi32.dll", "hwnd", "CreateDIBSection", "hwnd", $hDC, "ptr", DllStructGetPtr($tBmpInfo), _
    "uint", $iUsage, "ptr", $pBits, "hwnd", $hSecond, "uint", $iOffset)

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

    If @error Then Return SetError(@error, @extended, 0)
    If $aResult[0] = 87 Then Return SetError(1, 1, 0); 87 = ERROR_INVALID_PARAMETER
    If $aResult[0] = 0 Then Return SetError(1, 2, 0)
    Return SetError(0, 0, $aResult[0])
    EndFunc

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

    Func _WinAPI_DrawThemeTextEx($hTheme, $hDC, $iPartId, $iStateId, $sText, $iFlags, ByRef $tRect, Const ByRef $tDTTOPTS)
    Local $aResult = DllCall("uxtheme.dll", "int", "DrawThemeTextEx", "ptr", $hTheme, "hwnd", $hDC, "int", $iPartId, "int", $iStateId, _
    "wstr", $sText, "int", -1, "uint", $iFlags, "ptr", DllStructGetPtr($tRect), "ptr", DllStructGetPtr($tDTTOPTS))

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

    If @error Then Return SetError(@error, @extended, 0)
    If $aResult[0] <> 0 Then Return SetError(1, 0, 0)
    Return SetError(0, 0, $aResult[0] = 0)
    EndFunc

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

    Func _WinAPI_OpenThemeData($hWnd, $sClassList)
    Local $aResult = DllCall("uxtheme.dll", "hwnd", "OpenThemeData", "hwnd", $hWnd, "wstr", $sClassList)

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

    If @error Then Return SetError(@error, @extended, 0)
    If $aResult[0] = 0 Then Return SetError(1, 0, 0)
    Return SetError(0, 0, $aResult[0])
    EndFunc

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

    Func _WinAPI_CloseThemeData($hTheme)
    Local $aResult = DllCall("uxtheme.dll", "int", "CloseThemeData", "hwnd", $hTheme)

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

    If @error Then Return SetError(@error, @extended, 0)
    Return SetError(0, 0, $aResult[0] = 0)
    EndFunc
    #endregion

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

    Func MY_PAINT($hWnd, $Msg, $wParam, $lParam)
    _Draw_menus()
    Return $GUI_RUNDEFMSG
    EndFunc

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

    Func _Create_7Image() ;drawn by myself xP
    _GDIPlus_Startup()
    Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($controlGui)
    Local $hbitmap = _GDIPlus_BitmapCreateFromGraphics($iwidth, $iheight, $hGraphic)
    Local $backbuffer = _GDIPlus_ImageGetGraphicsContext($hbitmap)
    Local $LetterSize = 36
    Local $Letter = '7'
    Local $hbrush = _GDIPlus_BrushCreateSolid(0xFF152a3d)
    Local $hbrushB = _GDIPlus_BrushCreateSolid(0xFF000000)
    Local $hbrush2 = _GDIPlus_BrushCreateSolid(0x3A152a3d)
    Local $hbrush3 = _GDIPlus_BrushCreateSolid(0x28FFFFFF)
    Local $hFormat = _GDIPlus_StringFormatCreate ()
    Local $hFamily = _GDIPlus_FontFamilyCreate ("Times New Roman")
    Local $hPen = _GDIPlus_PenCreate (0xFF454545)
    Local $hFont = _GDIPlus_FontCreate ($hFamily, $LetterSize, 1)
    Local $tLayout
    Local $tLayout2

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

    #region malkey's gradient example ;creating gradient
    Local $aFact[4] = [0, 0.3, 0.6, 1.0]
    Local $aPosit[4] = [0.0, 0.3, 0.6, 1.0]
    Local $hBrushLin2 = gdiplus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFact, $aPosit, _
    0xFF5078fb, 0xFF91e9ff, 0x00000002, 1)
    _GDIPlus_GraphicsFillRect($backbuffer, $iX, $iY, $iWidth, $iHeight, $hBrushLin2)
    #endregion

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

    Local $StartNum = 1 ;creating little pixels to add texture
    for $j = 1 to 48
    for $i = $StartNum to 48 step 3
    _GDIPlus_GraphicsFillRect($backbuffer, $i-1, $j-1, 1, 1, $hbrush2)
    Next
    $StartNum += 1
    If $StartNum > 3 then $StartNum = 1
    Next
    Local $3D_Depth = 3
    $tLayout2 = _GDIPlus_RectFCreate ($iX+7, $iY-1, $iWidth, $iHeight)
    _GDIPlus_GraphicsDrawStringEx ($backbuffer, $Letter, $hFont, $tLayout2, $hFormat, $hbrush2) ;creating shadow under character
    For $i = 1 to $3D_Depth
    $tLayout = _GDIPlus_RectFCreate ($iX+6-$i, $iY-$i-2, $iWidth-4, $iHeight+4)
    If $i = $3D_Depth then
    _GDIPlus_GraphicsDrawStringEx ($backbuffer, $Letter, $hFont, $tLayout, $hFormat, $hBrush) ;creating character
    Else
    _GDIPlus_GraphicsDrawStringEx ($backbuffer, $Letter, $hFont, $tLayout, $hFormat, $hBrushB) ;creating character depth
    EndIf
    Next

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

    Local $i_a = 48 ;ellipse points
    Local $i_b = 32
    For $j = 1 to 48
    For $i = 1 to 48
    if $i >= Sqrt($i_a^2-$i_a^2*$j^2/$i_b^2) then _GDIPlus_GraphicsFillRect($backbuffer, 48-$i, 48-$j, 1, 1, $hbrush3) ;creating gloss with ellipse equation
    Next
    Next

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

    _GDIPlus_GraphicsDrawRect($backbuffer, $iX, $iY, $iWidth-1, $iHeight-1, $hPen) ;boxing entire image with dark grey line

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

    Local $GC = _GDIPlus_ImageGetGraphicsContext($hbitmap)
    Local $newBmp = _GDIPlus_BitmapCreateFromGraphics($iwidth, $iheight, $GC)
    Local $newGC = _GDIPlus_ImageGetGraphicsContext($newBmp)
    _GDIPlus_GraphicsDrawImageRect($newGC, $hbitmap, 0, 0, $iwidth, $iheight)
    _GDIPlus_ImageSaveToFile($newBmp, $temp_image) ;saving created image - it's easier to show image and leave it there, than redrawing this entire thing
    ;when GID+ gets disappeared
    _WinAPI_DeleteObject($hbitmap) ;disposing all the unneeded stuff
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_GraphicsDispose($GC)
    _GDIPlus_GraphicsDispose($newGC)
    _GDIPlus_BitmapDispose($newBmp)
    _GDIPlus_BrushDispose($hBrushLin2)
    _GDIPlus_BrushDispose($hbrush)
    _GDIPlus_BrushDispose($hbrushB)
    _GDIPlus_BrushDispose($hbrush2)
    _GDIPlus_BrushDispose($hbrush3)
    _GDIPlus_PenDispose ($hPen)
    _GDIPlus_FontDispose ($hFont)
    _GDIPlus_FontFamilyDispose ($hFamily)
    _GDIPlus_StringFormatDispose ($hFormat)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_ImageDispose($temp_image)
    _GDIPlus_Shutdown()
    EndFunc

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

    #region drawing gradient by Malkey (link at the top of the script)
    Func gdiplus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _
    $iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0)

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

    Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount

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

    If $iArgb1 = -1 Then $iArgb1 = 0xFF0000FF
    If $iArgb2 = -1 Then $iArgb2 = 0xFFFF0000
    If $LinearGradientMode = -1 Then $LinearGradientMode = 0x00000001
    If $WrapMode = -1 Then $WrapMode = 1

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

    $tRect = DllStructCreate("float X;float Y;float Width;float Height")
    $pRect = DllStructGetPtr($tRect)
    DllStructSetData($tRect, "X", $iX)
    DllStructSetData($tRect, "Y", $iY)
    DllStructSetData($tRect, "Width", $iWidth)
    DllStructSetData($tRect, "Height", $iHeight)

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

    ;Note: Withn _GDIPlus_Startup(), $ghGDIPDll is defined
    $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _
    "int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0)

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

    If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0]
    If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0]

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

    $iCount = UBound($aPositions)
    $tFactors = DllStructCreate("float[" & $iCount & "]")
    $pFactors = DllStructGetPtr($tFactors)
    For $iI = 0 To $iCount - 1
    DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1)
    Next
    $tPositions = DllStructCreate("float[" & $iCount & "]")
    $pPositions = DllStructGetPtr($tPositions)
    For $iI = 0 To $iCount - 1
    DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1)
    Next

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

    $hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _
    "ptr", $pFactors, "ptr", $pPositions, "int", $iCount)
    Return $aRet[6] ; Handle of Line Brush
    EndFunc ;==>Gdiplus_CreateLineBrushFromRect
    #endregion

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

    Func _CleanUp()
    _WinAPI_CloseThemeData($hTheme)
    FileDelete($temp_image)
    EndFunc

    [/autoit]

    MfG. tobi_girst

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »tobi_girst« (Morgen, 25:63)

    Einmal editiert, zuletzt von tobi_girst (31. Oktober 2012 um 00:05)

  • Das Problem ist, dass du von minimierten Fenstern kein Screenshot erstellen kannst. Windows scheint die Fenster alle vorher zu cachen!

    Ferner kannst du die DWM Thumbnail Funktion benutzen (siehe die _WinAPI_DwmUpdateThumbnailProperties.au3 Funktion aus der WinAPIEx.au3).

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • genau, alizame!
    Ich möchte nur die GUI nachbauen, die Fenstersymbole werde ich mit eigenen austauschen.
    lg

    MfG. tobi_girst

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »tobi_girst« (Morgen, 25:63)

  • Ich habe selbst in meinen Ferien nicht besonders viel Freizeit, daher kann ich dir damit im Moment wohl eher nicht so gut helfen.
    Wenn du nicht unbedingt etwas benötigst, das genauso aussieht wie eine Aero GUI, dann kann ich dir zumindest eine kleine Starthilfe bieten.
    Ich habe mal ein altes(!) Script von mir rausgekramt, das ich mal für irgendwen geschrieben hatte der ein Bild eines Rahmens segmentiert skalieren wollte (um jeglichen Qualitätsverlust zu verhindern). Ein paar Anpassungen waren noch nötig, aber es funktioniert zumindest (meiner Meinung nach sieht es dabei sogar cooler aus als die Aero Vorlage :whistling: ).
    Auf diese GUI kannst du nach belieben Bilder, Text etc. draufmalen.

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <GDIPlus.au3>
    #include <WinAPI.au3>
    #include <Misc.au3>

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

    ; - Author: name22 (http://www.autoit.de)

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

    Opt("GUIOnEventMode", 1)

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

    Global Const $nPiHalf = ACos(-1) / 2
    Global $vU32dll = DllOpen("user32.dll")

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

    ;###-v-SETTINGS-v-###

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

    $iGUIWidth = 600 ;Fensterbreite
    $iGUIHeight = 200 ;Fensterhöhe
    $iDurationON = 600 ;Zeit für das Einblenden des Fensters [in ms]
    $iDurationOFF = 400 ;Zeit für das Ausblenden des Fensters [in ms]

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

    ;###-^-SETTINGS-^-###

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

    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $iGUIWidth)
    DllStructSetData($tSize, "Y", $iGUIHeight)
    $tDest = DllStructCreate($tagSIZE)
    $pDest = DllStructGetPtr($tDest)
    DllStructSetData($tDest, "X", 0)
    DllStructSetData($tDest, "Y", 0)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", 0)
    DllStructSetData($tBlend, "Format", 1)

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

    $hMain = GUICreate("Example by name22", $iGUIWidth, $iGUIHeight, Default, Default, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW))
    GUISetState()

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

    $hDC_Main = _WinAPI_GetDC($hMain)
    $hDC_Buffer = _WinAPI_CreateCompatibleDC($hDC_Main)
    $hBitmap_Buffer = _WinAPI_CreateCompatibleBitmap($hDC_Main, $iGUIWidth, $iGUIHeight)
    _WinAPI_SelectObject($hDC_Buffer, $hBitmap_Buffer)

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

    _GDIPlus_Startup()

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

    $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_Buffer)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)

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

    $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)

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

    $hImage_BG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\bg.png")
    $aBG_Glass = _CutImage($hImage_BG)

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

    GUIRegisterMsg($WM_PAINT, "_RedrawGUI")
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Close", $hMain)
    OnAutoItExitRegister("_Shutdown")

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

    HotKeySet("{F10}", "_Show")

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

    While Sleep(1000)
    WEnd

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

    Func _Show()
    HotKeySet("{F10}")
    Local $iTimeOffset = 0, $iTime, $vTimer = TimerInit()

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

    GUISetState(@SW_SHOW, $hMain)
    While _IsPressed("79", $vU32dll)
    $iTime = Floor(TimerDiff($vTimer))
    If $iTime < $iDurationON Then
    $nFrac = Sin($iTime / $iDurationON * $nPiHalf)

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

    $iWidthTmp = $nFrac * $iGUIWidth
    $iHeightTmp = $nFrac * $iGUIHeight
    $iAlphaTmp = Floor($nFrac * 0xFF)

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

    _GUISettings($iWidthTmp, $iHeightTmp, @DesktopWidth / 2 - $iWidthTmp / 2, @DesktopHeight / 2 - $iHeightTmp / 2, $iAlphaTmp)
    EndIf
    Sleep(10)
    WEnd
    HotKeySet("{F10}", "_Show")

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

    If $iTime <= $iDurationON Then
    $iTimeOffset = $iDurationOFF - $iTime / $iDurationON * $iDurationOFF
    EndIf
    $iTime = 0
    $vTimer = TimerInit()
    While $iTime <= $iDurationOFF
    $iTime = Floor(TimerDiff($vTimer)) + $iTimeOffset
    $nFrac = Sin((1 - $iTime / $iDurationOFF) * $nPiHalf)

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

    $iWidthTmp = $nFrac * $iGUIWidth
    $iHeightTmp = $nFrac * $iGUIHeight
    $iAlphaTmp = Floor($nFrac * 0xFF)

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

    _GUISettings($iWidthTmp, $iHeightTmp, @DesktopWidth / 2 - $iWidthTmp / 2, @DesktopHeight / 2 - $iHeightTmp / 2, $iAlphaTmp)
    Sleep(10)
    WEnd
    _GUISettings(0, 0, 0, 0, 0)
    GUISetState(@SW_HIDE, $hMain)
    EndFunc

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

    Func _GUISettings($iWidth, $iHeight, $iX = -1, $iY = -1, $iAlpha = 255)
    DllStructSetData($tBlend, "Alpha", $iAlpha)
    DllStructSetData($tSize, "X", $iWidth)
    DllStructSetData($tSize, "Y", $iHeight)
    _WinAPI_DeleteObject($hBitmap_Buffer)
    _GDIPlus_GraphicsDispose($hGraphics)
    $hBitmap_Buffer = _WinAPI_CreateCompatibleBitmap($hDC_Main, $iWidth, $iHeight)
    _WinAPI_SelectObject($hDC_Buffer, $hBitmap_Buffer)
    $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_Buffer)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)
    _GDIPlus_GraphicsClear($hGraphics, 0)
    _DrawBG($aBG_Glass, $iWidth, $iHeight)
    If $iX = -1 And $iY = -1 Then
    _RedrawGUI()
    Else
    DllStructSetData($tDest, "X", Floor($iX))
    DllStructSetData($tDest, "Y", Floor($iY))
    _WinAPI_UpdateLayeredWindow($hMain, $hDC_Main, $pDest, $pSize, $hDC_Buffer, $pSource, 0, $pBlend, $ULW_ALPHA)
    EndIf
    EndFunc

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

    Func _DrawBG($aBG, $iWidth, $iHeight)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 0)
    _GDIPlus_GraphicsSetInterpolationMode($hGraphics, 5)
    _GDIPlus_GraphicsSetPixelOffsetMode($hGraphics, 2)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $aBG[0], 0, 0, 20, 20) ;upper left corner
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $aBG[1], 0, $iHeight - 17, 20, 17) ;lower left corner
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $aBG[2], $iWidth - 21, 0, 21, 20) ;upper right corner
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $aBG[3], $iWidth - 21, $iHeight - 17, 21, 17) ;lower right corner
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $aBG[4], 0, 20, 20, $iHeight - 37) ;left edge
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $aBG[5], $iWidth - 21, 20, 21, $iHeight - 37) ;right edge
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $aBG[6], 20, 0, $iWidth - 41, 20) ;upper edge
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $aBG[7], 20, $iHeight - 17, $iWidth - 41, 17) ;lower edge
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $aBG[8], 20, 20, $iWidth - 41, $iHeight - 37) ;center
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)
    EndFunc

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

    Func _CutImage($hImage)
    Local $aReturn[9]
    $aReturn[0] = _GDIPlus_BitmapCloneArea($hImage, 0, 0, 20, 20, $GDIP_PXF32ARGB) ;upper left corner
    $aReturn[1] = _GDIPlus_BitmapCloneArea($hImage, 0, 87, 20, 17, $GDIP_PXF32ARGB) ;lower left corner
    $aReturn[2] = _GDIPlus_BitmapCloneArea($hImage, 86, 0, 21, 20, $GDIP_PXF32ARGB) ;upper right corner
    $aReturn[3] = _GDIPlus_BitmapCloneArea($hImage, 86, 87, 21, 17, $GDIP_PXF32ARGB) ;lower right corner
    $aReturn[4] = _GDIPlus_BitmapCloneArea($hImage, 0, 20, 20, 67, $GDIP_PXF32ARGB) ;left edge
    $aReturn[5] = _GDIPlus_BitmapCloneArea($hImage, 86, 20, 21, 67, $GDIP_PXF32ARGB) ;right edge
    $aReturn[6] = _GDIPlus_BitmapCloneArea($hImage, 20, 0, 66, 20, $GDIP_PXF32ARGB) ;upper edge
    $aReturn[7] = _GDIPlus_BitmapCloneArea($hImage, 20, 87, 66, 17, $GDIP_PXF32ARGB) ;lower edge
    $aReturn[8] = _GDIPlus_BitmapCloneArea($hImage, 20, 20, 66, 67, $GDIP_PXF32ARGB) ;center
    Return $aReturn
    EndFunc

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

    Func _RedrawGUI()
    _WinAPI_UpdateLayeredWindow($hMain, $hDC_Main, 0, $pSize, $hDC_Buffer, $pSource, 0, $pBlend, $ULW_ALPHA)
    EndFunc

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

    Func _Close()
    Exit
    EndFunc ;==>_Close

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

    Func _Shutdown()
    _WinAPI_ReleaseDC($hMain, $hDC_Main)
    _WinAPI_DeleteDC($hDC_Buffer)
    _WinAPI_DeleteObject($hBitmap_Buffer)

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

    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_ImageDispose($hImage_BG)
    For $i = 0 To 8
    _GDIPlus_BitmapDispose($aBG_Glass[$i])
    Next
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_Shutdown()
    EndFunc ;==>_Shutdown

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_GraphicsSetPixelOffsetMode
    ; Description ...: Sets the pixel offset mode of a Graphics object
    ; Syntax.........: _GDIPlus_GraphicsSetPixelOffsetMode($hGraphics, $iPixelOffsetMode)
    ; Parameters ....: $hGraphics - Pointer to a Graphics object
    ; $iPixelOffsetMode - Pixel offset mode:
    ; |0,1,3 - Pixel centers have integer coordinates
    ; |2,4 - Pixel centers have coordinates that are half way between integer values (i.e. 0.5, 20, 105.5, etc...)
    ; Return values .: Success - True
    ; Failure - False and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: None
    ; Related .......: _GDIPlus_GraphicsGetPixelOffsetMode
    ; Link ..........; @@MsdnLink@@ GdipSetPixelOffsetMode
    ; Example .......; No
    ; ===============================================================================================================================
    Func _GDIPlus_GraphicsSetPixelOffsetMode($hGraphics, $iPixelOffsetMode)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetPixelOffsetMode", "hwnd", $hGraphics, "int", $iPixelOffsetMode)

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

    If @error Then Return SetError(@error, @extended, False)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_GraphicsSetPixelOffsetMode

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_GraphicsSetInterpolationMode
    ; Description ...: Sets the interpolation mode of a Graphics object
    ; Syntax.........: _GDIPlus_GraphicsSetInterpolationMode($hGraphics, $iInterpolationMode)
    ; Parameters ....: $hGraphics - Pointer to a Graphics object
    ; $iInterpolationMode - Interpolation mode:
    ; |0 - Default interpolation mode
    ; |1 - Low-quality mode
    ; |2 - High-quality mode
    ; |3 - Bilinear interpolation. No prefiltering is done
    ; |4 - Bicubic interpolation. No prefiltering is done
    ; |5 - Nearest-neighbor interpolation
    ; |6 - High-quality, bilinear interpolation. Prefiltering is performed to ensure high-quality shrinking
    ; |7 - High-quality, bicubic interpolation. Prefiltering is performed to ensure high-quality shrinking
    ; Return values .: Success - True
    ; Failure - False and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: The interpolation mode determines the algorithm that is used when images are scaled or rotated
    ; Related .......: _GDIPlus_GraphicsGetInterpolationMode
    ; Link ..........; @@MsdnLink@@ GdipSetInterpolationMode
    ; Example .......; No
    ; ===============================================================================================================================
    Func _GDIPlus_GraphicsSetInterpolationMode($hGraphics, $iInterpolationMode)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "hwnd", $hGraphics, "int", $iInterpolationMode)

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

    If @error Then Return SetError(@error, @extended, False)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_GraphicsSetInterpolationMode

    [/autoit]


    Das Bild muss im Scriptverzeichnis sein. F10 startet das Ganze.
    Falls es nicht für deine Zwecke geeignet ist, hatte ich wenigstens mal die Gelegenheit das zu posten :D.

  • Hier ein "Fast Hack" und nicht voll getestet:

    Spoiler anzeigen
    [autoit]


    ;coded by UEZ 2012 build 2012-10-30
    #AutoIt3Wrapper_Compile_Both=n
    #AutoIt3Wrapper_UseX64=n
    #AutoIt3Wrapper_Run_Obfuscator=y
    #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
    #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_Obfuscated.au3"
    #AutoIt3Wrapper_UseUPX=y
    #AutoIt3Wrapper_UPX_Parameters=--best --lzma
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <GDIPlus.au3>
    #include <File.au3>
    #include <Constants.au3>
    #include <Array.au3>

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

    Opt('MustDeclareVars', 1)

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

    If Not _WinAPI_DwmIsCompositionEnabled() Then Exit MsgBox(16, 'Error', 'Require Windows Vista or later with enabled Aero theme.')

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

    _GDIPlus_Startup()

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

    Global Const $iW = 128, $iH = 128, $iSpace = 32, $iDW = Max(@DesktopWidth * 0.3, @DesktopWidth * 0.9), $iFont = 12, $iDeltaFrame = 8

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

    Global $sPathKey = "HKLM64\SOFTWARE\AutoIt v3\AutoIt\"
    If @OSArch = "x64" Then $sPathKey = "HKLM\SOFTWARE\Wow6432Node\AutoIt v3\AutoIt\"
    Global $sPath = RegRead($sPathKey, "InstallDir") & "\Examples\GUI\"

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

    Global $aList = CreateImageArray($sPath, $iW, $iH)
    If @error Then Exit MsgBox(16, "Error", "No images found")

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

    Global $iImages = UBound($aList)
    Global $iColum = Floor($iDW / ($iW + $iSpace))
    Global $iRow = Ceiling($iImages / $iColum)

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

    Global Const $STM_SETIMAGE = 0x0172
    Global $iGUI_W = Min($iDW, $iImages * ($iSpace + $iW)), $iGUI_H = $iRow * ($iSpace + $iH) + 1.5 * $iFont + $iDeltaFrame * 5
    Global $hGUI = GUICreate("Alt+Tab Preview Like Window by UEZ 2012 beta", $iGUI_W, $iGUI_H, -1, -1, 0, $WS_EX_DLGMODALFRAME)
    GUISetBkColor(0)
    _WinAPI_DwmExtendFrameIntoClientArea($hGUI)
    Global $iLabel = GUICtrlCreateLabel("", 0, 0, $iGUI_W, $iFont * 1.75, $SS_CENTER)
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetFont(-1, $iFont, 400, 0, "Tahoma", 5)

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

    Global $j = 0, $x = 0, $y = 0, $hHBITMAP, $iYPos

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

    Do
    $iYPos = 1.5 * $iFont + $iSpace / 2 + $y * ($iH + $iSpace)
    $aList[$j][1] = GUICtrlCreateLabel("", -$iDeltaFrame + $iSpace / 2 + $x * ($iSpace + $iW), -$iDeltaFrame + $iYPos, $iW + $iDeltaFrame * 2, $iH + $iDeltaFrame * 2, Default, Default)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlSetBkColor(-1, 0x0)
    $aList[$j][2] = GUICtrlCreatePic("", $iSpace / 2 + $x * ($iSpace + $iW), $iYPos, $iW, $iH, Default, Default)
    $aList[$j][3] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($aList[$j][0])
    _WinAPI_DeleteObject(GUICtrlSendMsg($aList[$j][2], $STM_SETIMAGE, $IMAGE_BITMAP, $aList[$j][3]))
    $aList[$j][5] = 0
    $x = Mod($x + 1, $iColum)
    If Not $x Then $y = Mod($y + 1, $iRow)
    $j += 1
    Until $j = UBound($aList)
    GUISetState()

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

    Global $aChk
    Do
    If WinActive($hGUI) Then
    $aChk = GUIGetCursorInfo($hGUI)
    Hover($aChk[4], $aList, $aChk[2])
    EndIf
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

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

    GUIDelete()

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

    ;release ressources
    For $j = 0 To UBound($aList) - 1
    _WinAPI_DeleteObject($aList[$j][3])
    _GDIPlus_BitmapDispose($aList[$j][0])
    Next
    _GDIPlus_Shutdown()
    Exit

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

    Func Hover($idCtrl, ByRef $array, $bPrimDown = False)
    Local Static $iElement
    Local $k
    For $k = 0 To UBound($array) - 1
    If $array[$k][2] = $idCtrl Then
    If $bPrimDown = 1 Then
    ShellExecute($array[$k][4])
    $bPrimDown = False
    Sleep(500)
    EndIf
    If $iElement <> $idCtrl Then ;check to avoid flickering
    GUICtrlSetData($iLabel, $array[$k][4])
    GUICtrlSetBkColor($array[$k][1], 0x101050)
    GUICtrlSetStyle($aList[$k][1], Default, $WS_EX_STATICEDGE)
    $iElement = $idCtrl
    $array[$k][5] = 1
    EndIf
    Else
    If $array[$k][5] = 1 Then ;check to avoid flickering
    GUICtrlSetBkColor($array[$k][1], 0x0)
    GUICtrlSetStyle($aList[$k][1], Default, 0)
    $array[$k][5] = 0
    $iElement = -1
    EndIf
    EndIf
    Next
    EndFunc ;==>Hover

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

    Func Min($a, $b)
    If $a < $b Then Return $a
    Return $b
    EndFunc ;==>Min

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

    Func Max($a, $b)
    If $a > $b Then Return $a
    Return $b
    EndFunc ;==>Max

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

    Func CreateImageArray($sPath, $iW_TN = 128, $iH_TN = 128)
    Local $aFiles = _FileListToArray($sPath, "*", 1)
    If Not IsArray($aFiles) Then Return SetError(1, 0, 0)
    Local $sExt = "JPG|BMP|GIF|PNG|"
    Local $i = 0
    While $i < UBound($aFiles) - 1
    If Not StringInStr($sExt, StringRight($aFiles[$i], 3)) Then
    _ArrayDelete($aFiles, $i)
    Else
    $i += 1
    EndIf
    WEnd
    Local $iUB = UBound($aFiles) - 1
    If Not $iUB Then Return SetError(2, 0, 0)
    Local $aResult[$iUB + 1][6], $hImage, $hBmp, $hCtxt, $iW, $iH, $w, $h, $f
    For $i = 0 To $iUB
    $aResult[$i][4] = $sPath & $aFiles[$i]
    $hImage = _GDIPlus_ImageLoadFromFile($aResult[$i][4])
    $iW = _GDIPlus_ImageGetWidth($hImage)
    $iH = _GDIPlus_ImageGetHeight($hImage)

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

    $hBmp = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW_TN, "int", $iH_TN, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
    $aResult[$i][0] = $hBmp[6]
    $hCtxt = _GDIPlus_ImageGetGraphicsContext($aResult[$i][0])

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

    If $iW < $iW_TN And $iH < $iH_TN Then
    _GDIPlus_GraphicsDrawImageRect($hCtxt, $hImage, $iW_TN / 2 - $iW / 2, $iH_TN / 2 - $iH / 2, $iW, $iH)
    Else
    If $iW > $iH Then
    $f = $iW / $iW_TN
    Else
    $f = $iH / $iH_TN
    EndIf
    $w = Int($iW / $f)
    $h = Int($iH / $f)
    _GDIPlus_GraphicsDrawImageRect($hCtxt, $hImage, $iW_TN / 2 - $w / 2, $iH_TN / 2 - $h / 2, $w, $h)
    EndIf
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_ImageDispose($hImage)
    Next
    Return $aResult
    EndFunc ;==>CreateImageArray

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

    Func _WinAPI_DwmExtendFrameIntoClientArea($hWnd, $tMARGINS = 0)
    If Not IsDllStruct($tMARGINS) Then
    $tMARGINS = _WinAPI_CreateMargins(-1, -1, -1, -1)
    EndIf
    Local $Ret = DllCall('dwmapi.dll', 'uint', 'DwmExtendFrameIntoClientArea', 'hwnd', $hWnd, 'ptr', DllStructGetPtr($tMARGINS))
    If @error Then
    Return SetError(1, 0, 0)
    Else
    If $Ret[0] Then
    Return SetError(1, $Ret[0], 0)
    EndIf
    EndIf
    Return 1
    EndFunc ;==>_WinAPI_DwmExtendFrameIntoClientArea

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

    Func _WinAPI_CreateMargins($iLeftWidth, $iRightWidth, $iTopHeight, $iBottomHeight)
    Local $tMARGINS = DllStructCreate($tagMARGINS)
    DllStructSetData($tMARGINS, 1, $iLeftWidth)
    DllStructSetData($tMARGINS, 2, $iRightWidth)
    DllStructSetData($tMARGINS, 3, $iTopHeight)
    DllStructSetData($tMARGINS, 4, $iBottomHeight)
    Return $tMARGINS
    EndFunc ;==>_WinAPI_CreateMargins

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

    Func _WinAPI_DwmIsCompositionEnabled()
    Local $Ret = DllCall('dwmapi.dll', 'uint', 'DwmIsCompositionEnabled', 'int*', 0)
    If @error Then
    Return SetError(1, 0, 0)
    Else
    If $Ret[0] Then
    Return SetError(1, $Ret[0], 0)
    EndIf
    EndIf
    Return $Ret[1]
    EndFunc ;==>_WinAPI_DwmIsCompositionEnabled

    [/autoit]

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

    9 Mal editiert, zuletzt von UEZ (30. Oktober 2012 um 17:55)

  • Hmm, ich arbeite ausschließlich unter Win7 X64, wobei standardmäßig x86 Code ausgeführt wird. Vielleicht liegt's ja daran, dass es bei mir funzt.

    Die Anordnung der Bilder in der GUI ist noch buggy, aber jetzt habe ich keine Lust mehr, das zu fixen.

    Vielleicht irgend wann mal...

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Ich habe jetzt mal an meinem Script ein bisschen weiter geschrieben, und es in einen eigenen Thread gepackt damit es leichter wieder zu finden ist.
    Hier befindet sich das ganze, falls noch Interesse besteht. Aber eigentlich hat UEZ das ja schon souverän gelöst ;).

  • vielen Dank liebe Nachtmenschen! dass sich jemand um Mitternacht bis drei Uhr für meine Anliegen Zeit nimmt ist äußerst nett. Ich werde die Codes sofort ausprobieren!

    MfG. tobi_girst

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »tobi_girst« (Morgen, 25:63)

  • vielen dank! ich habe jetzt beide skripte ausprobiert und finde sie toll! ich habe mich für uez's skript entschieden, nichts für ungut, name22! dein skript gefällt mir auch (nur habe ich etwas gegen background-images und deine steuerung)
    besteht interesse an meinem zwei-pedal-skript?

    lg

    MfG. tobi_girst

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »tobi_girst« (Morgen, 25:63)

  • Du kannst es ja als Beispiel (oder sogar als kleine UDF) in Skripte posten, wenn du Lust hast ;). Ich glaube nicht, dass es hier schon irgendwas mit Fußpedalsteuerung gibt.

    Zitat

    nichts für ungut, name22!


    Keine Sorge, ich bin nicht beleidigt :P.

  • dafür würd's viel aufräumen benötigen...im Grunde besteht meine Schaltung aus einem Tastaturmodul und einem Taster (im Pedal); die Software ist HotkeySet () in Kombination mit Send (->AltTab, in Skripte gepostet) und ControlSend für die Spotify-Steuerung.

    MfG. tobi_girst

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »tobi_girst« (Morgen, 25:63)