Wechsel zwischen geöffneten Fenstern

  • Hallo zusammen,

    ich versuche zur Zeit eine kleine GUI zum wechseln zwischen geöffneten Fenstern zu erstellen (wie Alt+TAB).
    Hintergrund:
    Das ganze soll auf einer fünf Meter breiten, interaktiven Wand laufen, welche leider nur über single Touch verfügt.. Alt+TAB geht also nicht und Flip3D über Win+TAB ist auch nicht wirklich befriedigend.
    Vielleicht hat ja der ein oder andere hier ein paar Verbesserungsvorschläge für mich? Falls es möglich ist, die Vorschaubilder der Fenster oder die Programmicons für die Buttons zu bekommen wäre das super!
    Hier mein Code:
    Ist noch sehr frisch, aber man bekommt eine Vorstellung... Haltet euch
    nicht zurück, fall das alles Mist ist und es sinnvollere Ansätze gibt ;)

    Grüße,
    notna

    Edit: Script läuft mittlerweile wie gewünscht :D Vielen Dank an Raupi und name22 für die großartige Unterstützung! Hier also die optiierte, wohl endgültige Version:

    Spoiler anzeigen
    [autoit]

    #region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Compile_Both=y
    #AutoIt3Wrapper_UseX64=y
    #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <WinAPI.au3>
    #include <Misc.au3>
    #include <Process.au3>
    _Singleton("switch", 0)

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

    Opt("GUICoordMode", 0)
    Opt("TrayIconHide", 1)

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

    Global Const $GCL_CBCLSEXTRA = -20
    Global Const $GCL_CBWNDEXTRA = -18
    Global Const $GCL_HBRBACKGROUND = -10
    Global Const $GCL_HCURSOR = -12
    Global Const $GCL_HICON = -14
    Global Const $GCL_HICONSM = -34
    Global Const $GCL_HMODULE = -16
    Global Const $GCL_MENUNAME = -8
    Global Const $GCL_STYLE = -26
    Global Const $GCL_WNDPROC = -24

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

    $allwindows = WinList()
    $count = $allwindows[0][0]
    Global $relatedwindows[$count][$count]
    $rows = 1
    $colums = 0
    $cnt = 1
    $j = 1
    $mouseX = MouseGetPos(0)
    Global $thirdW = @DesktopWidth / 3
    $third2 = (2 * $thirdW)
    $third3 = @DesktopWidth
    $x1 = ($thirdW / 2 - 332)
    $x2 = ($thirdW + $x1)
    $x3 = ($thirdW + $x2)
    Global $winH = @DesktopHeight
    Global $2thirdW = 2 * @DesktopWidth / 3
    Global $maxW = @DesktopWidth
    Global $m1X = 0
    Global $m2X = @DesktopWidth / 3
    Global $m3X = 2 * @DesktopWidth / 3
    ;;

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

    Global $guiW, $guiH; auf jeden Fall deklarieren, sonst mault AutoIt
    ;---> Positionsbestimmung
    If $mouseX <= $thirdW Then
    $guiX = $x1
    ElseIf $mouseX <= $third2 Then
    $guiX = $x2
    ElseIf $mouseX <= $third3 Then
    $guiX = $x3
    EndIf
    ;---> Fenster sammeln & Filtern. Anzahl von Zeilen & Spalten bestimmen.
    For $i = 1 To $count
    If (BitAND(WinGetState($allwindows[$i][1]), 16) Or WinGetState($allwindows[$i][1]) = 7) And $allwindows[$i][0] <> "Start" And $allwindows[$i][0] <> "Program Manager" And $allwindows[$i][0] <> "DWM Notification Window" And $allwindows[$i][0] <> "AMD:CCC-AEMCapturingWindow" And $allwindows[$i][0] <> "2. Client Starten" And $allwindows[$i][0] <> "SBSDKInstance" And $allwindows[$i][0] <> "" Then
    $relatedwindows[$j][0] = $allwindows[$i][0]
    $relatedwindows[$j][1] = $allwindows[$i][1]
    $colums = $colums + 1
    $j = $j + 1
    If $colums > 4 Then
    $colums = 1
    $rows = $rows + 1
    EndIf
    EndIf
    Next

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

    ;---> Maße der GUI gemäß Zeilen & Spalten
    If $j == 1 Then
    $guiW = 260
    ElseIf $j <= 4 Then
    $guiW = $j * 115
    Else
    $guiW = 550
    EndIf
    $guiH = ($rows * 90)
    $ygap = 80

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

    ;---> semitransparenter Hintergrund
    $background = GUICreate("", $guiW, $guiH, $guiX, -1, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetBkColor(0x01)
    _Gui_RoundCorners($background, 0, 0, 50, 50)
    WinSetTrans($background, "", 100)
    GUISetState()

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

    ;---> transparente GUI mit "Kacheln" für die Fenster
    $winswitch = GUICreate("Switch", $guiW, $guiH, $guiX, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST), $background)
    GUISetBkColor(0x01)
    $hDC_Window = _WinAPI_GetDC($winswitch) ;---> DC für Icon extract...

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

    ;---> Meldung, falls keine Fenster geunden wurden...
    If $j == 1 Then
    GUICtrlCreateLabel("", 20, 40, 215, 35)
    GUICtrlSetBkColor(-1, 0x757273)
    GUICtrlCreateLabel("sorry, there are no windows...", 5, 5, 230, 25)
    GUICtrlSetFont(-1, 12, 500, 0, "Segoe UI")
    GUICtrlSetColor(-1, 0xffffff)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    Else
    For $i = 1 To $j - 1
    If $i = 1 Then ; Erster Button
    $relatedwindows[1][2] = GUICtrlCreateButton($relatedwindows[1][0], 25, 25, 110, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE))
    ElseIf $cnt = 4 Then; 4. Button in der Zeile
    $relatedwindows[$i][2] = GUICtrlCreateButton("", -388, -1 + $ygap, 110, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE))
    $cnt = 1
    Else
    $relatedwindows[$i][2] = GUICtrlCreateButton("", -1 + 130, -1, 110, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE))
    $cnt = $cnt + 1
    EndIf
    ;Hier ist die Deklaration zu Ende, der übrige Code bleibt gleich
    $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 2, 0, 0, Default, Default, "HANDLE")
    If Not $hIcon Then $hIcon = GetIconfromExe($relatedwindows[$i][0])
    If Not $hIcon Then $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 0, 0, 0, Default, Default, "HANDLE")
    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICON)
    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICONSM)

    GUICtrlSetData($relatedwindows[$i][2], StringLeft($relatedwindows[$i][0], 10));Buttontext einfügen, egal ob es ein Icon gibt !!!!
    GUICtrlSetFont($relatedwindows[$i][2], 10, 400, 0, "Segoe UI")
    If $hIcon Then
    Local $hOldImage = _SendMessage(GUICtrlGetHandle($relatedwindows[$i][2]), $BM_SETIMAGE, 1, $hIcon)
    _SendMessage($winswitch, $WM_ERASEBKGND, $hDC_Window)
    _WinAPI_DestroyIcon($hOldImage);Altes ButtonIcon zerstören
    _WinAPI_DestroyIcon($hIcon)
    EndIf
    Next
    EndIf
    GUISetState()
    _WinAPI_SetLayeredWindowAttributes($winswitch, 0x01, 255)

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

    ;---> Falls keine Fester gefunden: Meldung für 3sec zeigen und dann beenden.
    If $j == 1 Then
    Sleep(3000)
    Exit
    EndIf

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

    While 1
    $msg = GUIGetMsg()
    WinSetOnTop($winswitch, "", 1)
    Switch $msg
    Case $GUI_EVENT_CLOSE
    Exit
    Case Else
    ;---> Auf Buttons lauschen
    For $i = 1 To $j - 1
    If $msg = ($relatedwindows[$i][2]) Then
    __PopUp($relatedwindows[$i][0])
    Exit
    EndIf
    Next

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

    EndSwitch
    WEnd
    ;---> PoUp mit Aktionen für gewähltes Fenster
    Func __PopUp($window)
    $position = GUICreate("", 338, 280, $guiX, -1, $WS_POPUP, $WS_EX_TOPMOST, $background);Wenn diese Gui als vorderste liegen soll und die HauptGui nicht mehr anklickbar sein soll, Parent als letzten Parameter setzen.
    GUISetBkColor(0x01)
    ;==> Positions
    GUICtrlCreateGroup("", 25, 25, 290, 160)
    GUICtrlSetColor(-1, 0xffffff)
    GUICtrlCreateLabel(" Action ", 15, -8, 63, 25)
    GUICtrlSetFont(-1, 12, 500, 0, "Segoe UI")
    GUICtrlSetColor(-1, 0xffffff)
    $m1 = GUICtrlCreateButton("", -1, 30, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m1-gui.ico")
    $m2 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m2-gui.ico")
    $m3 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m3-gui.ico")
    $m12 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m12-gui.ico")
    $m23 = GUICtrlCreateButton("", -210, 70, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m23-gui.ico")
    $max = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\maximize-gui.ico")
    $min = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\minimize-gui.ico")
    $close = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\close-gui.ico")
    $esc = GUICtrlCreateButton("cancel", -105, 90, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
    _Gui_RoundCorners($position, 0, 0, 50, 50)
    GUISetState(@SW_SHOW)
    While 1
    $button = GUIGetMsg()
    Switch $button
    Case $GUI_EVENT_CLOSE
    Exit
    Case $m1
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m2
    WinActivate($window, "")
    $positionX = $m2X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m3
    WinActivate($window, "")
    $positionX = $m3X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m12
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $2thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m23
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $2thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $max
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $maxW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $min
    WinSetState($window, "", @SW_MINIMIZE)
    Exit
    Case $close
    WinClose($window, "")
    Exit
    Case $esc
    Return
    EndSwitch
    WEnd
    EndFunc ;==>__PopUp

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

    Func _Gui_RoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
    Local $XS_pos, $XS_ret, $XS_ret2
    $XS_pos = WinGetPos($h_win)
    $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3)
    If $XS_ret[0] Then
    $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1)
    EndIf
    EndFunc ;==>_Gui_RoundCorners

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

    Func _WinAPI_GetClassLongEx($hWnd, $iIndex)

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

    Local $Ret

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

    If @AutoItX64 Then
    $Ret = DllCall('user32.dll', 'ulong_ptr', 'GetClassLongPtrW', 'hwnd', $hWnd, 'int', $iIndex)
    Else
    $Ret = DllCall('user32.dll', 'ulong', 'GetClassLongW', 'hwnd', $hWnd, 'int', $iIndex)
    EndIf
    If (@error) Or (Not $Ret[0]) Then
    Return SetError(1, 0, 0)
    EndIf
    Return $Ret[0]
    EndFunc ;==>_WinAPI_GetClassLongEx

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

    Func GetIconfromExe($Title)
    Local $iIcons = 1; 1
    Local $t_ahIcons = DllStructCreate("HWND[" & $iIcons & "]") ;HWND Array um die Icons zu erhalten
    Local $p_ahIcons = DllStructGetPtr($t_ahIcons)
    Local $PID = WinGetProcess($Title)
    Local $Prozessname = _ProcessGetName($PID)
    Local $AndwendungsPfad = _GetPathByPid($PID)
    If $Prozessname <> "explorer.exe" Then
    _WinAPI_ExtractIconEx($AndwendungsPfad, 0, 0, $p_ahIcons, $iIcons)
    If Not @error Then Return DllStructGetData($t_ahIcons, 1, 1)
    Return 0
    Else; Fenster gehört zu Explorer.exe geladen wird dabei das 202. ICon aus der imageres.dll. ggF. kann auch ein anderes verwendet werde.
    _WinAPI_ExtractIconEx(@SystemDir & "\imageres.dll", 202, 0, $p_ahIcons, $iIcons)
    If Not @error Then Return DllStructGetData($t_ahIcons, 1, 1)
    Return 0
    EndIf
    EndFunc ;==>GetIconfromExe

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

    Func _GetPathByPid($iPID); gefunden im Englischen Forum , verfasser nicht bekannt.
    Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', 0x0410, 'int', 0, 'int', $iPID)
    If $aProc[0] = 0 Then Return SetError(1, 0, '')
    Local $vStruct = DllStructCreate('int[1024]')
    DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int_ptr', 0)
    Local $aReturn = DllCall('psapi.dll', 'int', 'GetModuleFileNameExW', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'wstr', '', 'int', 2048)
    If $aReturn[0] = 0 Then Return SetError(2, 0, '')
    Return $aReturn[3]
    EndFunc ;==>_GetPathByPid

    [/autoit]

    2 Mal editiert, zuletzt von notna (7. Juni 2013 um 12:07)

  • Also ohne mir dein Skript näher angesehen zu haben (bin selber noch Anfänger), würde ich die Verwendung von Hotkeys empfehlen:

    Spoiler anzeigen
    [autoit]

    HotKeySet("{ESC}", "_Exit");==> nur zum Beenden dieses Beispiels

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

    OnAutoItExitRegister("_KeysUP");==> um sicher zu gehen, dass keine der Tasten eingerastet bleibt, egal wie das Programm beendet wird

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

    HotKeySet("{a}", "_Alt");==> "a" drücken, um Alt Taste permanent "einzurasten"
    HotKeySet("!{ENTER}", "_AltEnter");==> Enter drücken, um Fenster zu wählen (!{ENTER} = Alt Taste + Enter)
    HotKeySet("#a", "_AltNachWin");==> falls zuerst die Windows Taste und dann die Alt Taste gedrückt wird
    HotKeySet("!{ESC}", "_Exit");==> Programm beenden, auch wenn Alt Taste "eingerastet" ist.

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

    HotKeySet("{SPACE}", "_Win");==> Space drücken, um linke Windows Taste permanent "einzurasten"
    HotKeySet("#{ENTER}", "_WinEnter");==> Enter drücken, um Fenster zu wählen (#{ENTER} = Windows Taste + Enter)
    HotKeySet("!{SPACE}", "_WinNachAlt");==> falls zuerst die Alt Taste und dann die Windows Taste gedrückt wird
    HotKeySet("#{ESC}", "_Exit");==> Programm beenden, auch wenn Windows Taste "eingerastet" ist.

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

    While 1
    Sleep(5000)
    WEnd

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

    Func _Alt();==> wenn aktiviert, einfach TAB Taste drücken (ACHTUNG: ALLE anderen Tasten werden jetzt auch mit der Alt Taste kombiniert)
    Send ("{ALTDOWN}")
    EndFunc

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

    Func _AltNachWin();==> falls vorher die Windows Taste "eingerastet" wurde
    Send("{LWINUP}")
    Send ("{ALTDOWN}")
    EndFunc

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

    Func _Win();==> wenn aktiviert, einfach TAB Taste drücken (ACHTUNG: ALLE anderen Tasten werden jetzt auch mit der linken Windows Taste kombiniert)
    Send("{LWINDOWN}")
    EndFunc

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

    Func _WinNachAlt();==> falls vorher die Alt Taste "eingerastet" wurde
    Send("{ALTUP}")
    Send("{LWINDOWN}")
    EndFunc

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

    Func _AltEnter();==> Enter drücken, um gewähltes Fenster in den Vordergrund zu holen und gleichzeitig die Alt Taste wieder "auszurasten"
    Send("{ALTUP}")
    ;_Exit()
    EndFunc

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

    Func _WinEnter();==> Enter drücken, um gewähltes Fenster in den Vordergrund zu holen und gleichzeitig die linke Windows Taste wieder "auszurasten"
    Send("{LWINUP}")
    ;_Exit()
    EndFunc

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

    Func _KeysUP();==> um sicher zu gehen, dass keine der Tasten eingerastet bleibt, egal wie das Programm beendet wird
    Send("{ALTUP}")
    Send("{LWINUP}")
    EndFunc

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

    Func _Exit()
    Exit
    EndFunc

    [/autoit]

    Ich habe jetzt mal Alt und Windows Taste gleichzeitig eingebaut.
    Aber aufpassen, wenn man vergißt, dass eine der Tasten noch "eingerastet" ist, kann VIEL Chaos passieren :cursing:
    Evtl. könnte man noch mit Hilfe der AdlibRegister Funktion einen Sicherheitsmechanismus einbauen, damit keine der Tasten eingerastet bleibt.
    Ausserdem könnte man noch diesen Code als seperates Programm mit z.B. einer F-Taste starten, welches nach Durchlauf der _AltEnter() bzw. _WinEnter() Funktion beendet wird (siehe Zeile 41 bzw. Zeile 46)

    *edit*
    Natürlich lässt sich das ganze auch direkt aus einem Skript mittels WinActivate und WinSetState steuern...
    Daran hatte ich garnicht mehr gedacht :wacko:

    *edit²*
    siehe unten für bessere Version...

  • @notna: Ich würde das nächste mal vielleicht den Code noch in einen AutoIt Block setzen ;)

    Außerdem konnte ich net ganz entnehmen was du möchtest. Möchtest du eine Oberfläche die alle aktiven Fenster zeigt und dann via Hotkeys/Clicks/Whatever darauf wechseln kannst?

    Wie schon erwähnt, gehe ich mal davon aus das meine Annahme richtig ist, dann würde ich dir empfehlen WinActive mal anzuschauen.

    So Far

    Grüße Yaerox

    Grüne Hölle

  • Hab mir meinen Skript-Schnipsel nochmal angesehen und eine deutlich komfortablere und kürzere Version erstellt:

    Spoiler anzeigen
    [autoit]

    HotKeySet("{ESC}", "_Exit");==> nur zum Beenden dieses Beispiels

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

    OnAutoItExitRegister("_KeysUP");==> um sicher zu gehen, dass keine der Tasten eingerastet bleibt, egal wie das Programm beendet wird

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

    HotKeySet("{TAB}", "_TAB");==> Nach Drücken der TAB Taste wird sofort das ALT-TAB Menü aufgerufen

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

    ;HotKeySet("{RIGHT}", "_TAB");==> So gehts auch und man ist sofort auf der richtigen Taste, wenn man Links/Rechts/Oben/Unten navigieren möchte
    ;HotKeySet("{LEFT}", "_TAB");==> aber die Curser Tasten sind dauerhaft belegt
    ;HotKeySet("{UP}", "_TAB")
    ;HotKeySet("{DOWN}", "_TAB")

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

    HotKeySet("{SPACE}", "_LWIN");==> Nach Drücken der SPACE Taste wird sofort das WIN-TAB Menü aufgerufen
    ;==> Die Windows Taste selber kann man leider nicht abfangen, soweit ich weiß

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

    HotKeySet("!{ENTER}", "_KeysUP");==> ENTER wählt Fenster aus und "entrastet" TAB (!{ENTER} = Alt Taste + Enter)
    HotKeySet("#{ENTER}", "_KeysUP");==> ENTER wählt Fenster aus und "entrastet" LWIN (#{ENTER} = Windows Taste + Enter)
    HotKeySet("!{ESC}", "_KeysUP");==> Wird ESC bei eingerasteter ALT Taste nicht abgefangen, bleibt ALT aktiviert
    HotKeySet("#{ESC}", "_KeysUP");==> Wird ESC bei eingerasteter LWIN Taste nicht abgefangen, bleibt LWIN aktiviert

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

    While 1
    Sleep(5000)
    WEnd

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

    Func _TAB()
    Send("{LWINUP}")
    Send("{ALTDOWN}")
    Send("{TAB}")
    EndFunc

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

    Func _LWIN()
    Send("{ALTUP}")
    Send("{LWINDOWN}")
    Send("{TAB}")
    EndFunc

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

    Func _KeysUP()
    Send("{ALTUP}")
    Send("{LWINUP}")
    ;_Exit()
    EndFunc

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

    Func _Exit()
    Exit
    EndFunc

    [/autoit]
  • Hi,

    habe den Code mal in einen Autoit Block gesetzt, danke für den Hinweis ;)
    Der Ansatz mit Hotkeys ist für mich leider nichts, da ich das ganze ja an einer Touch-Projektionsfläche betreibe und keine Tastatur verwende. Zudem wird das Alt+TAB Fenster immer in der Bildschirmmitte dargestellt. Ich muss allerdings in der Lage sein, die GUI an verschiedenen Positionen darzustellen (-> 5m breiter "Bildschirm").
    Mein Ziel ist also eine dynamische GUI, in welcher alle offenen Fenster über Buttons auswählbar sind. Mein Script sammelt alle Fenster über WinList und filtert einige Einträge heraus. Abhängig von der Anzahl der Fenster wird eine GUI mit Buttons aufgebaut. Die Buttons sind mit den Fenstertiteln beschriftet (sicht besonders schön bei langen Titeln). Auslösen eines Buttons aktiviert das entsprechende Fenster und beendet das Script (habe auch eine Version mit zusätzlchem WinMove).
    Soweit fuktioniert es ganz gut. Der einzige Bug den ich habe ist, dass bei einer von USB geöffneten Word-Datei das Script direkt dieses Fenster aktiviert und beendet wird... Keine Ahnung woran das liegt.
    Schön fände ich wie gesagt, wenn man an die Icons oder Vorschaubilder kommen könnte, wie das bei der Windows eigenen Variante der Fall ist.

    Grüße,
    notna

  • Den Begriff "single Touch" kannte ich so noch nicht.
    Ich dachte, das bedeutet, dass nur eine Taste auf einmal abgefragt werden kann (bzw. Rückmeldung der Projektion), daher mein Ansatz mit den Hotkeys, weil das halt mit einzelnen Tastendrücken funktioniert und ohne Kombinationen wie ALT-TAB auskommt...

  • So, hier mal die aktuelle, funktionierende Version:

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <WinAPI.au3>
    #include <Misc.au3>

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

    _Singleton("switch", 0)

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

    Opt("GUICoordMode", 0)
    Opt("TrayIconHide", 1)

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

    $allwindows = WinList()
    $count = $allwindows[0][0]
    Global $relatedwindows[$count][$count]
    $rows=1
    $colums=0
    $cnt=1
    $j=1
    $mouseX=MouseGetPos(0)
    Global $thirdW=@DesktopWidth/3
    $third2=(2*$thirdW)
    $third3=@DesktopWidth
    $x1=($thirdW/2-332)
    $x2=($thirdW+$x1)
    $x3=($thirdW+$x2)
    Global $winH=@DesktopHeight
    Global $2thirdW=2*@DesktopWidth/3
    Global $maxW=@DesktopWidth
    Global $m1X=0
    Global $m2X=@DesktopWidth/3
    Global $m3X=2*@DesktopWidth/3

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

    If $mouseX<=$thirdW Then
    $guiX=$x1
    ElseIf $mouseX<=$third2 Then
    $guiX=$x2
    ElseIf $mouseX<=$third3 Then
    $guiX=$x3
    EndIf
    For $i = 1 to $count
    If (BitAND(WinGetState($allwindows[$i][1]), 16) Or WinGetState($allwindows[$i][1]) = 7) AND $allwindows[$i][0] <> "Start" AND $allwindows[$i][0] <> "Program Manager" AND $allwindows[$i][0] <> "DWM Notification Window" AND $allwindows[$i][0] <> "AMD:CCC-AEMCapturingWindow" AND $allwindows[$i][0] <> "2. Client Starten" AND $allwindows[$i][0] <> "SBSDKInstance" AND $allwindows[$i][0] <> "" Then
    $relatedwindows[$j][0] = $allwindows[$i][0]
    $relatedwindows[$j][1] = $allwindows[$i][1]
    $colums = $colums+1
    $j = $j +1
    if $colums > 4 Then
    $colums = 1
    $rows = $rows+1
    EndIf
    EndIf
    Next

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

    if $j == 1 Then
    $guiW = 260
    ElseIf $j <=4 Then
    $guiW = $j*95
    Else
    $guiW = 500
    EndIf
    $guiH = ($rows * 120)
    $ygap = 120

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

    $background = GUICreate("", $guiW, $guiH, $guiX, -1, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetBkColor(0x01)
    _Gui_RoundCorners($background, 0, 0, 50, 50)
    WinSetTrans ( $background, "", 100)
    GUISetState()

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

    $winswitch = GUICreate("Switch", $guiW, $guiH, $guiX, -1, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOPMOST))
    GUISetBkColor(0x01)

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

    If $j == 1 Then
    GUICtrlCreateLabel("", 20, 40, 215, 35)
    GUICtrlSetBkColor(-1, 0x757273)
    GUICtrlCreateLabel("sorry, there are no windows...", 5, 5, 230, 25)
    GUICtrlSetFont(-1, 12, 500, 0, "Segoe UI")
    GUICtrlSetColor(-1, 0xffffff)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    Else
    Assign($relatedwindows[1][0], GUICtrlCreateButton($relatedwindows[1][0], 40, 15, 90, 90, $BS_MULTILINE))
    GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
    for $i = 2 to $j-1
    if $cnt = 4 Then
    Assign($relatedwindows[$i][0], GUICtrlCreateButton($relatedwindows[$i][0], -328, -1 + $ygap, 90, 90, $BS_MULTILINE))
    GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
    $cnt = 1
    Else
    Assign($relatedwindows[$i][0], GUICtrlCreateButton($relatedwindows[$i][0], -1 + 110, -1, 90, 90, $BS_MULTILINE))
    GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
    $cnt = $cnt + 1
    EndIf
    Next
    EndIf
    GUISetState()
    _WinAPI_SetLayeredWindowAttributes($winswitch, 0x01, 255)
    If $j == 1 Then
    Sleep(3000)
    Exit
    EndIf

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

    While 1
    $msg = GUIGetMsg()
    WinSetOnTop($winswitch, "", 1)
    Switch $msg
    Case $GUI_EVENT_CLOSE
    Exit
    Case Else
    for $i=1 to $j -1
    if $msg = Eval($relatedwindows[$i][0]) Then
    __PopUp($relatedwindows[$i][0])
    Exit
    EndIf
    Next
    EndSwitch
    WEnd

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

    Func __PopUp($window)
    $position = GUICreate("", 338, 280, $guiX, -1, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetBkColor(0x01)
    ;==> Positions
    GUICtrlCreateGroup("", 25, 25, 290, 160)
    GUICtrlSetColor(-1, 0xffffff)
    GUICtrlCreateLabel(" Action ", 15, -8, 63, 25)
    GUICtrlSetFont(-1, 12, 500, 0, "Segoe UI")
    GUICtrlSetColor(-1, 0xffffff)
    $m1 = GUICtrlCreateButton("", -1, 30, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m1-gui.ico")
    $m2 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m2-gui.ico")
    $m3 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m3-gui.ico")
    $m12 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m12-gui.ico")
    $m23 = GUICtrlCreateButton("", -210, 70, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m23-gui.ico")
    $max = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\maximize-gui.ico")
    $min = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\minimize-gui.ico")
    $close = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\close-gui.ico")
    $esc = GUICtrlCreateButton("cancel", -105, 90, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
    _Gui_RoundCorners($position, 0, 0, 50, 50)
    GUISetState(@SW_SHOW)
    While 1
    $button = GUIGetMsg()
    Switch $button
    Case $GUI_EVENT_CLOSE
    Exit
    Case $m1
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m2
    WinActivate($window, "")
    $positionX = $m2X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m3
    WinActivate($window, "")
    $positionX = $m3X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m12
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $2thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m23
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $2thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $max
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $maxW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $min
    WinSetState($window, "", @SW_MINIMIZE)
    Exit
    Case $close
    WinClose($window, "")
    Exit
    Case $esc
    Return
    EndSwitch
    WEnd
    EndFunc

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

    Func _Gui_RoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
    Local $XS_pos, $XS_ret, $XS_ret2
    $XS_pos = WinGetPos($h_win)
    $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3)
    If $XS_ret[0] Then
    $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1)
    EndIf
    EndFunc

    [/autoit]


    Und hier mein Versuch die Methoden von name22 (Icons extrahieren)einzubinden:

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <WinAPI.au3>
    #include <Misc.au3>

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

    _Singleton("switch", 0)

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

    Opt("GUICoordMode", 0)
    Opt("TrayIconHide", 1)

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

    Global Const $GCL_CBCLSEXTRA = -20
    Global Const $GCL_CBWNDEXTRA = -18
    Global Const $GCL_HBRBACKGROUND = -10
    Global Const $GCL_HCURSOR = -12
    Global Const $GCL_HICON = -14
    Global Const $GCL_HICONSM = -34
    Global Const $GCL_HMODULE = -16
    Global Const $GCL_MENUNAME = -8
    Global Const $GCL_STYLE = -26
    Global Const $GCL_WNDPROC = -24

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

    $allwindows = WinList()
    $count = $allwindows[0][0]
    Global $relatedwindows[$count][$count]
    $rows=1
    $colums=0
    $cnt=1
    $j=1
    $mouseX=MouseGetPos(0)
    Global $thirdW=@DesktopWidth/3
    $third2=(2*$thirdW)
    $third3=@DesktopWidth
    $x1=($thirdW/2-332)
    $x2=($thirdW+$x1)
    $x3=($thirdW+$x2)
    Global $winH=@DesktopHeight
    Global $2thirdW=2*@DesktopWidth/3
    Global $maxW=@DesktopWidth
    Global $m1X=0
    Global $m2X=@DesktopWidth/3
    Global $m3X=2*@DesktopWidth/3

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

    If $mouseX<=$thirdW Then
    $guiX=$x1
    ElseIf $mouseX<=$third2 Then
    $guiX=$x2
    ElseIf $mouseX<=$third3 Then
    $guiX=$x3
    EndIf
    For $i = 1 to $count
    If (BitAND(WinGetState($allwindows[$i][1]), 16) Or WinGetState($allwindows[$i][1]) = 7) AND $allwindows[$i][0] <> "Start" AND $allwindows[$i][0] <> "Program Manager" AND $allwindows[$i][0] <> "DWM Notification Window" AND $allwindows[$i][0] <> "AMD:CCC-AEMCapturingWindow" AND $allwindows[$i][0] <> "2. Client Starten" AND $allwindows[$i][0] <> "SBSDKInstance" AND $allwindows[$i][0] <> "" Then
    $relatedwindows[$j][0] = $allwindows[$i][0]
    $relatedwindows[$j][1] = $allwindows[$i][1]
    $colums = $colums+1
    $j = $j +1
    if $colums > 4 Then
    $colums = 1
    $rows = $rows+1
    EndIf
    EndIf
    Next

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

    if $j == 1 Then
    $guiW = 260
    ElseIf $j <=4 Then
    $guiW = $j*95
    Else
    $guiW = 500
    EndIf
    $guiH = ($rows * 120)
    $ygap = 120

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

    $background = GUICreate("", $guiW, $guiH, $guiX, -1, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetBkColor(0x01)
    _Gui_RoundCorners($background, 0, 0, 50, 50)
    WinSetTrans ( $background, "", 100)
    GUISetState()

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

    $winswitch = GUICreate("Switch", $guiW, $guiH, $guiX, -1, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOPMOST))
    GUISetBkColor(0x01)
    $hDC_Window = _WinAPI_GetDC($winswitch)

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

    If $j == 1 Then
    GUICtrlCreateLabel("", 20, 40, 215, 35)
    GUICtrlSetBkColor(-1, 0x757273)
    GUICtrlCreateLabel("sorry, there are no windows...", 5, 5, 230, 25)
    GUICtrlSetFont(-1, 12, 500, 0, "Segoe UI")
    GUICtrlSetColor(-1, 0xffffff)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    Else
    $kachel = Assign($relatedwindows[1][0], GUICtrlCreateButton($relatedwindows[1][0], 40, 15, 90, 90,BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON)))
    ;GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
    $tmp = _WinAPI_GetDC($kachel)
    $hIcon = _SendMessage($relatedwindows[1][1], $WM_GETICON, 2, 0, 0, Default, Default, "HANDLE")

    If Not $hIcon Then $hIcon = _SendMessage($relatedwindows[1][1], $WM_GETICON, 0, 0, 0, Default, Default, "HANDLE")

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

    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[1][1], $GCL_HICON)

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

    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[1][1], $GCL_HICONSM)

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

    If $hIcon Then
    GUICtrlSetImage($kachel, $hIcon)
    ;_WinAPI_DrawIconEx($kachel, 64, 64, $tmp);, 128, 128, 0, 0, 3) ;beides mal versucht...
    _SendMessage($winswitch, $WM_ERASEBKGND, $hDC_Window)
    _WinAPI_DestroyIcon($hIcon)
    EndIf
    for $i = 2 to $j-1
    if $cnt = 4 Then
    $kachel = Assign($relatedwindows[$i][0], GUICtrlCreateButton($relatedwindows[$i][0], -328, -1 + $ygap, 90, 90, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON)))
    ;GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
    $cnt = 1
    $tmp = _WinAPI_GetDC($kachel)
    $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 2, 0, 0, Default, Default, "HANDLE")

    If Not $hIcon Then $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 0, 0, 0, Default, Default, "HANDLE")

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

    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICON)

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

    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICONSM)

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

    If $hIcon Then
    GUICtrlSetImage($kachel, $hIcon)
    ;_WinAPI_DrawIconEx($kachel, 64, 64, $tmp);, 128, 128, 0, 0, 3) ;beides mal versucht...
    _SendMessage($winswitch, $WM_ERASEBKGND, $hDC_Window)
    _WinAPI_DestroyIcon($hIcon)
    EndIf
    Else
    $kachel = Assign($relatedwindows[$i][0], GUICtrlCreateButton($relatedwindows[$i][0], -1 + 110, -1, 90, 90, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON)))
    ;GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
    $cnt = $cnt + 1
    $tmp = _WinAPI_GetDC($kachel)
    $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 2, 0, 0, Default, Default, "HANDLE")

    If Not $hIcon Then $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 0, 0, 0, Default, Default, "HANDLE")

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

    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICON)

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

    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICONSM)

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

    If $hIcon Then
    GUICtrlSetImage($kachel, $hIcon)
    ;_WinAPI_DrawIconEx($kachel, 64, 64, $tmp);, 128, 128, 0, 0, 3) ;beides mal versucht...
    _SendMessage($winswitch, $WM_ERASEBKGND, $hDC_Window)
    _WinAPI_DestroyIcon($hIcon)
    EndIf
    EndIf
    Next
    EndIf
    GUISetState()
    _WinAPI_SetLayeredWindowAttributes($winswitch, 0x01, 255)
    If $j == 1 Then
    Sleep(3000)
    Exit
    EndIf

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

    While 1
    $msg = GUIGetMsg()
    WinSetOnTop($winswitch, "", 1)
    Switch $msg
    Case $GUI_EVENT_CLOSE
    Exit
    Case Else
    for $i=1 to $j -1
    if $msg = Eval($relatedwindows[$i][0]) Then
    __PopUp($relatedwindows[$i][0])
    Exit
    EndIf
    Next
    EndSwitch
    WEnd

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

    Func __PopUp($window)
    $position = GUICreate("", 338, 280, $guiX, -1, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetBkColor(0x01)
    ;==> Positions
    GUICtrlCreateGroup("", 25, 25, 290, 160)
    GUICtrlSetColor(-1, 0xffffff)
    GUICtrlCreateLabel(" Action ", 15, -8, 63, 25)
    GUICtrlSetFont(-1, 12, 500, 0, "Segoe UI")
    GUICtrlSetColor(-1, 0xffffff)
    $m1 = GUICtrlCreateButton("", -1, 30, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m1-gui.ico")
    $m2 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m2-gui.ico")
    $m3 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m3-gui.ico")
    $m12 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m12-gui.ico")
    $m23 = GUICtrlCreateButton("", -210, 70, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m23-gui.ico")
    $max = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\maximize-gui.ico")
    $min = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\minimize-gui.ico")
    $close = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\close-gui.ico")
    $esc = GUICtrlCreateButton("cancel", -105, 90, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
    _Gui_RoundCorners($position, 0, 0, 50, 50)
    GUISetState(@SW_SHOW)
    While 1
    $button = GUIGetMsg()
    Switch $button
    Case $GUI_EVENT_CLOSE
    Exit
    Case $m1
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m2
    WinActivate($window, "")
    $positionX = $m2X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m3
    WinActivate($window, "")
    $positionX = $m3X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m12
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $2thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m23
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $2thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $max
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $maxW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $min
    WinSetState($window, "", @SW_MINIMIZE)
    Exit
    Case $close
    WinClose($window, "")
    Exit
    Case $esc
    Return
    EndSwitch
    WEnd
    EndFunc

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

    Func _Gui_RoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
    Local $XS_pos, $XS_ret, $XS_ret2
    $XS_pos = WinGetPos($h_win)
    $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3)
    If $XS_ret[0] Then
    $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1)
    EndIf
    EndFunc

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

    Func _WinAPI_GetClassLongEx($hWnd, $iIndex)

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

    Local $Ret

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

    If @AutoItX64 Then
    $Ret = DllCall('user32.dll', 'ulong_ptr', 'GetClassLongPtrW', 'hwnd', $hWnd, 'int', $iIndex)
    Else
    $Ret = DllCall('user32.dll', 'ulong', 'GetClassLongW', 'hwnd', $hWnd, 'int', $iIndex)
    EndIf
    If (@error) Or (Not $Ret[0]) Then
    Return SetError(1, 0, 0)
    EndIf
    Return $Ret[0]
    EndFunc

    [/autoit]
  • Nichts für ungut, aber auf mich wirkt dein Script völlig konfus...
    Um dir kurz zu erklären was ich meine:

    - Du verwendest Assign um einem Array-Element einen Wert zuzuweisen.
    1. Assign verlangt den Namen einer Variable als String für den ersten Parameter, nicht den Wert der Variable.
    2. Du brauchst kein Assign um einen Wert einer Variable zuzuweisen.
    3. Du kannst einem Arrayelement keinen Wert mit Assign zuweisen, das ist nicht möglich und steht auch ausdrücklich so in der Hilfe.
    4. Assign gibt einen Integerwert (0 oder 1) zurück, es macht keinen Sinn das in eine Variable zu schreiben.
    -> Du verwendest Assign so falsch wie ich es nie zuvor gesehen habe und ich bin mir noch nicht mal sicher, was du eigentlich damit erreichen willst.

    - Der Wert von Assign der in $kachel gespeichert wurde (in deinem Fall 0 weil Assign fehlschlägt).
    1. Du versuchst einen DC (DeviceContext) aus diesem Wert (0) zu erzeugen, was in deinem Fall absolut keinen Sinn macht.
    2. Danach versuchst du auf einen DC (0) der kein DC ist ein Icon zu zeichnen das kein Icon ist. Das was das Icon sein sollte ist der DC von Punkt 1 der keinen Sinn macht aus offensichtlichen Gründen.
    3. Du versuchst GUICtrlSetImage mit einem handle zu einem Icon im Arbeitsspeicher zu verwenden, obwohl die Funktion nur Dateinamen zu Icondateien auf der HDD akzeptiert.
    -> Du hast vermutlich nicht verstanden wie mein Script vorgeht, was ich dir keineswegs ankreiden will, schließlich habe ich keine Kommentare eingefügt, aber man sieht es.. deutlich.

    Das sind maximal 10% der Probleme die mir aufgefallen sind. Dein Script ist nur lauffähig, weil die Funktionen die falsch benutzt werden netterweise nur einen Fehlercode zurückgeben.
    Fast jede Funktion die aus meinem Script stammt hat mindestens einen komplett falschen Parameter. Ich bin mir nicht sicher was du da schreibst, aber ich glaube nicht dass es AutoIt ist. Denn du verwendest selbst Standardbefehle wie Assign falsch.

    • Offizieller Beitrag

    Zu dem, was name22 geschrieben hat hier nochwas:
    Du darfst den Style $BS_ICON bei deinen Buttons nicht verwenden, wenn das Icon gesetzt wird gibt es keinen Text mehr auf dem Button.

    Da ich durch dein Variablenwirrwarr nicht duchsteige, hier mal ein Beispiel:

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <WinAPI.au3>
    #include <ButtonConstants.au3>
    ;WinAPIEx.au3:
    Global Const $GCL_CBCLSEXTRA = -20
    Global Const $GCL_CBWNDEXTRA = -18
    Global Const $GCL_HBRBACKGROUND = -10
    Global Const $GCL_HCURSOR = -12
    Global Const $GCL_HICON = -14
    Global Const $GCL_HICONSM = -34
    Global Const $GCL_HMODULE = -16
    Global Const $GCL_MENUNAME = -8
    Global Const $GCL_STYLE = -26
    Global Const $GCL_WNDPROC = -24

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

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

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

    $hWnd = GUICreate("Searching...", 600, 100)
    $button = GUICtrlCreateButton("",10,10,580,40,BitOr($BS_MULTILINE, $BS_PUSHLIKE))
    GUISetState()

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

    $hDC_Window = _WinAPI_GetDC($hWnd)

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

    $aList = WinList()

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

    For $i = 1 To $aList[0][0]
    If BitAND(WinGetState($aList[$i][1]), 3)=3 AND $aList[$i][0] <>"" Then
    $hIcon = _SendMessage($aList[$i][1], $WM_GETICON, 2, 0, 0, Default, Default, "HANDLE")

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

    If Not $hIcon Then $hIcon = _SendMessage($aList[$i][1], $WM_GETICON, 0, 0, 0, Default, Default, "HANDLE")

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

    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($aList[$i][1], $GCL_HICON)

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

    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($aList[$i][1], $GCL_HICONSM)

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

    If $hIcon Then
    ConsoleWrite($aList[$i][0] & @LF)
    GUICtrlSetData($button,StringLeft ($aList[$i][0],100))
    Local $hOldImage = _SendMessage(GUICtrlGetHandle($button), $BM_SETIMAGE , 1, $hIcon) ;http://msdn.microsoft.com/en-us/library/…v=vs.85%29.aspx
    WinSetTitle($hWnd, "", $aList[$i][0])
    _WinAPI_DestroyIcon($hOldImage)
    _WinAPI_DestroyIcon($hIcon)
    Sleep(2000)
    EndIf
    EndIf
    Next

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

    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    ExitLoop
    EndSwitch
    WEnd

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _WinAPI_GetClassLongEx
    ; Description....: Retrieves the specified value associated with the specified window.
    ; Syntax.........: _WinAPI_GetClassLongEx ( $hWnd, $iIndex )
    ; Parameters.....: $hWnd - Handle to the window.
    ; $iIndex - The value to retrieve. This parameter can be one of the following values.
    ;
    ; $GCL_CBCLSEXTRA
    ; $GCL_CBWNDEXTRA
    ; $GCL_HBRBACKGROUND
    ; $GCL_HCURSOR
    ; $GCL_HICON
    ; $GCL_HICONSM
    ; $GCL_HMODULE
    ; $GCL_MENUNAME
    ; $GCL_STYLE
    ; $GCL_WNDPROC
    ;
    ; Return values..: Success - The requested value.
    ; Failure - 0 and sets the @error flag to non-zero.
    ; Author.........: Yashied
    ; Modified.......:
    ; Remarks........: None
    ; Related........:
    ; Link...........: @@MsdnLink@@ GetClassLong
    ; Example........: Yes
    ; ===============================================================================================================================

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

    Func _WinAPI_GetClassLongEx($hWnd, $iIndex)

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

    Local $Ret

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

    If @AutoItX64 Then
    $Ret = DllCall('user32.dll', 'ulong_ptr', 'GetClassLongPtrW', 'hwnd', $hWnd, 'int', $iIndex)
    Else
    $Ret = DllCall('user32.dll', 'ulong', 'GetClassLongW', 'hwnd', $hWnd, 'int', $iIndex)
    EndIf
    If (@error) Or (Not $Ret[0]) Then
    Return SetError(1, 0, 0)
    EndIf
    Return $Ret[0]
    EndFunc ;==>_WinAPI_GetClassLongEx

    [/autoit]

    Es ist das Beispiel von name22, nur en bisschen abgeändert. ;)

  • Da war ja echt de Wurm drin.. Danke für die Nachhilfe. Ich bin noch sehr neu hier. Das Script habe ich mit viel brute force / Google erstellt und war am Ende froh eine dynamische, funktionierende GUI zu haben... Da ich keine Fehler hatte, ist mir mein Mißverständniss nicht aufgefallen. Habe alle Assign und Eval Funktionen rausgeschmissen. Buttons erstelle ich jetzt so:

    Spoiler anzeigen
    [autoit]


    $relatedwindows[$i][2] = GUICtrlCreateButton("", -1 + 110, -1, 90, 90, BitOr($BS_MULTILINE, $BS_PUSHLIKE))

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

    $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 2, 0, 0, Default, Default, "HANDLE")

    If Not $hIcon Then $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 0, 0, 0, Default, Default, "HANDLE")

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

    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICON)

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

    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICONSM)

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

    If $hIcon Then
    Local $hOldImage = _SendMessage(GUICtrlGetHandle($relatedwindows[$i][2]), $BM_SETIMAGE , 1, $hIcon)
    GUICtrlSetData($relatedwindows[$i][2],StringLeft ($relatedwindows[$i][0],10))
    _SendMessage($winswitch, $WM_ERASEBKGND, $hDC_Window)
    _WinAPI_DestroyIcon($hOldImage)
    _WinAPI_DestroyIcon($hIcon)
    EndIf

    [/autoit]


    Die Icons sind drin! Nur das vom Explorer wird nicht extrahiert / angezeigt.
    Die ganzen Variablen brauche ich da die Größe der GUI von der Anzahl der Fenster und die Position von dem Aufrufsort des Script abhängen. Ein Entwickler bzw. geübter Programmierer hätte da bestimmt noch den ein oder anderen Verbesserungsvorschlag.

    • Offizieller Beitrag

    Wenn du den ein oder anderen Verbesserungvorschlag haben willst, poste nicht immer nur einen Codefetzen, sondern ein ausführbares Script ;)
    Das erleichert den Helfenden, dir zu helfen ;)

    Btw, es gibt einige Programme (Fenster) bei denen die Extraktion des Icons aus dem Window nicht funkioniert. Z.B. Codeblocks, Mediaplayer, Hotmail.
    Da gäbe es die Möglichkeit das Icon aus der Programmdatei zu holen. Das ist aber viel aufwändiger. Wenn du Interesse daran hast und es bis zum Wochenende Zeit hat, such ich die
    benötigten Funktionen zusamme. Irgendwo geistern die noch rum, von meinem Taskmanager.


    Edit: Da mir gerade danach war, hab ich mal ein Beispiel mit extraktion des Icon aus der Exe Datei gebastelt.

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <WinAPI.au3>
    #include <ButtonConstants.au3>
    #include <Process.au3>

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

    Global Const $GCL_CBCLSEXTRA = -20
    Global Const $GCL_CBWNDEXTRA = -18
    Global Const $GCL_HBRBACKGROUND = -10
    Global Const $GCL_HCURSOR = -12
    Global Const $GCL_HICON = -14
    Global Const $GCL_HICONSM = -34
    Global Const $GCL_HMODULE = -16
    Global Const $GCL_MENUNAME = -8
    Global Const $GCL_STYLE = -26
    Global Const $GCL_WNDPROC = -24
    Global $Xpos=10
    ; -Author: name22 (http://www.autoit.de)

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

    $hWnd = GUICreate("Searching...", 600, 800)
    GUISetState()

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

    $hDC_Window = _WinAPI_GetDC($hWnd)

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

    $aList = WinList()

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

    For $i = 1 To $aList[0][0]
    If BitAND(WinGetState($aList[$i][1]), 3) = 3 And $aList[$i][0] <> "" Then
    $hIcon = _SendMessage($aList[$i][1], $WM_GETICON, 2, 0, 0, Default, Default, "HANDLE")

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

    If Not $hIcon Then $hIcon = _SendMessage($aList[$i][1], $WM_GETICON, 0, 0, 0, Default, Default, "HANDLE")

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

    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($aList[$i][1], $GCL_HICON)

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

    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($aList[$i][1], $GCL_HICONSM)

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

    If Not $hIcon Then $hIcon = GetIconfromExe($aList[$i][0])
    If $hIcon Then
    Local $button = GUICtrlCreateButton("", 10, $xPos, 580, 40, BitOR($BS_MULTILINE, $BS_PUSHLIKE))
    GUICtrlSetData($button, StringLeft($aList[$i][0], 100))
    Local $hOldImage = _SendMessage(GUICtrlGetHandle($button), $BM_SETIMAGE, 1, $hIcon)
    WinSetTitle($hWnd, "", $aList[$i][0])
    _WinAPI_DestroyIcon($hOldImage)
    _WinAPI_DestroyIcon($hIcon)
    $xpos +=40
    EndIf
    EndIf
    Next

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

    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    ExitLoop
    EndSwitch
    WEnd

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _WinAPI_GetClassLongEx
    ; Description....: Retrieves the specified value associated with the specified window.
    ; Syntax.........: _WinAPI_GetClassLongEx ( $hWnd, $iIndex )
    ; Parameters.....: $hWnd - Handle to the window.
    ; $iIndex - The value to retrieve. This parameter can be one of the following values.
    ;
    ; $GCL_CBCLSEXTRA
    ; $GCL_CBWNDEXTRA
    ; $GCL_HBRBACKGROUND
    ; $GCL_HCURSOR
    ; $GCL_HICON
    ; $GCL_HICONSM
    ; $GCL_HMODULE
    ; $GCL_MENUNAME
    ; $GCL_STYLE
    ; $GCL_WNDPROC
    ;
    ; Return values..: Success - The requested value.
    ; Failure - 0 and sets the @error flag to non-zero.
    ; Author.........: Yashied
    ; Modified.......:
    ; Remarks........: None
    ; Related........:
    ; Link...........: @@MsdnLink@@ GetClassLong
    ; Example........: Yes
    ; ===============================================================================================================================

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

    Func _WinAPI_GetClassLongEx($hWnd, $iIndex)

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

    Local $Ret

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

    If @AutoItX64 Then
    $Ret = DllCall('user32.dll', 'ulong_ptr', 'GetClassLongPtrW', 'hwnd', $hWnd, 'int', $iIndex)
    Else
    $Ret = DllCall('user32.dll', 'ulong', 'GetClassLong', 'hwnd', $hWnd, 'int', $iIndex)
    EndIf
    If (@error) Or (Not $Ret[0]) Then
    Return SetError(1, 0, 0)
    EndIf
    Return $Ret[0]
    EndFunc ;==>_WinAPI_GetClassLongEx

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

    Func GetIconfromExe($Title)
    Local $iIcons = 1; 1
    Local $PID = WinGetProcess($Title)
    Local $Prozessname = _ProcessGetName($PID)
    Local $AndwendungsPfad = _GetPathByPid($PID)
    ConsoleWrite($AndwendungsPfad & @LF)
    Local $t_ahIcons = DllStructCreate("HWND[" & $iIcons & "]") ;HWND Array um die Icons zu erhalten
    Local $p_ahIcons = DllStructGetPtr($t_ahIcons)
    _WinAPI_ExtractIconEx($AndwendungsPfad, 0, 0, $p_ahIcons, $iIcons)
    If Not @error Then Return DllStructGetData($t_ahIcons, 1, 1)
    ConsoleWrite("Error" & $AndwendungsPfad & @LF)
    Return 0
    EndFunc ;==>GetIconfromExe

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

    Func _GetPathByPid($iPID); gefunden im Englischen Forum , verfasser nicht bekannt.
    Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', 0x0410, 'int', 0, 'int', $iPID)
    If $aProc[0] = 0 Then Return SetError(1, 0, '')
    Local $vStruct = DllStructCreate('int[1024]')
    DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int_ptr', 0)
    Local $aReturn = DllCall('psapi.dll', 'int', 'GetModuleFileNameExW', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'wstr', '', 'int', 2048)
    If $aReturn[0] = 0 Then Return SetError(2, 0, '')
    Return $aReturn[3]
    EndFunc ;==>_GetPathByPid

    [/autoit]


    Wichtig: Wenn das Beispiel unter Win7/64 Bit läuft, muß es auch als x64 Compiliert werden, sonst werden die Programmpfade der EXE Dateien nicht gefunden.
    Das Beispiel läuft also nicht als 32 Bit (X86) unter Win7/64.

  • Hier mal das gesamte Script mit ein paar Kommentaren. War etwas spät gestern und ich hatte dann keinen Elan mehr es noch aufzuräumen ;)

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <WinAPI.au3>
    #include <Misc.au3>

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

    _Singleton("switch", 0)

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

    Opt("GUICoordMode", 0)
    Opt("TrayIconHide", 1)

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

    Global Const $GCL_CBCLSEXTRA = -20
    Global Const $GCL_CBWNDEXTRA = -18
    Global Const $GCL_HBRBACKGROUND = -10
    Global Const $GCL_HCURSOR = -12
    Global Const $GCL_HICON = -14
    Global Const $GCL_HICONSM = -34
    Global Const $GCL_HMODULE = -16
    Global Const $GCL_MENUNAME = -8
    Global Const $GCL_STYLE = -26
    Global Const $GCL_WNDPROC = -24

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

    $allwindows = WinList()
    $count = $allwindows[0][0]
    Global $relatedwindows[$count][$count]
    $rows=1
    $colums=0
    $cnt=1
    $j=1
    $mouseX=MouseGetPos(0)
    Global $thirdW=@DesktopWidth/3
    $third2=(2*$thirdW)
    $third3=@DesktopWidth
    $x1=($thirdW/2-332)
    $x2=($thirdW+$x1)
    $x3=($thirdW+$x2)
    Global $winH=@DesktopHeight
    Global $2thirdW=2*@DesktopWidth/3
    Global $maxW=@DesktopWidth
    Global $m1X=0
    Global $m2X=@DesktopWidth/3
    Global $m3X=2*@DesktopWidth/3

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

    ;---> Positionsbestimmung
    If $mouseX<=$thirdW Then
    $guiX=$x1
    ElseIf $mouseX<=$third2 Then
    $guiX=$x2
    ElseIf $mouseX<=$third3 Then
    $guiX=$x3
    EndIf
    ;---> Fenster sammeln & Filtern. Anzahl von Zeilen & Spalten bestimmen.
    For $i = 1 to $count
    If (BitAND(WinGetState($allwindows[$i][1]), 16) Or WinGetState($allwindows[$i][1]) = 7) AND $allwindows[$i][0] <> "Start" AND $allwindows[$i][0] <> "Program Manager" AND $allwindows[$i][0] <> "DWM Notification Window" AND $allwindows[$i][0] <> "AMD:CCC-AEMCapturingWindow" AND $allwindows[$i][0] <> "2. Client Starten" AND $allwindows[$i][0] <> "SBSDKInstance" AND $allwindows[$i][0] <> "" Then
    $relatedwindows[$j][0] = $allwindows[$i][0]
    $relatedwindows[$j][1] = $allwindows[$i][1]
    $colums = $colums+1
    $j = $j +1
    if $colums > 4 Then
    $colums = 1
    $rows = $rows+1
    EndIf
    EndIf
    Next

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

    ;---> Maße der GUI gemäß Zeilen & Spalten
    if $j == 1 Then
    $guiW = 260
    ElseIf $j <=4 Then
    $guiW = $j*95
    Else
    $guiW = 500
    EndIf
    $guiH = ($rows * 120)
    $ygap = 120

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

    ;---> semitransparenter Hintergrund
    $background = GUICreate("", $guiW, $guiH, $guiX, -1, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetBkColor(0x01)
    _Gui_RoundCorners($background, 0, 0, 50, 50)
    WinSetTrans ( $background, "", 100)
    GUISetState()

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

    ;---> transparente GUI mit "Kacheln" für die Fenster
    $winswitch = GUICreate("Switch", $guiW, $guiH, $guiX, -1, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOPMOST))
    GUISetBkColor(0x01)
    $hDC_Window = _WinAPI_GetDC($winswitch) ;---> DC für Icon extract...

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

    ;---> Meldung, falls keine Fenster geunden wurden...
    If $j == 1 Then
    GUICtrlCreateLabel("", 20, 40, 215, 35)
    GUICtrlSetBkColor(-1, 0x757273)
    GUICtrlCreateLabel("sorry, there are no windows...", 5, 5, 230, 25)
    GUICtrlSetFont(-1, 12, 500, 0, "Segoe UI")
    GUICtrlSetColor(-1, 0xffffff)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    Else
    ;---> erster Button
    $relatedwindows[1][2] = GUICtrlCreateButton($relatedwindows[1][0], 40, 15, 90, 90,BitOr($BS_MULTILINE, $BS_PUSHLIKE))

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

    $hIcon = _SendMessage($relatedwindows[1][1], $WM_GETICON, 2, 0, 0, Default, Default, "HANDLE")

    If Not $hIcon Then $hIcon = _SendMessage($relatedwindows[1][1], $WM_GETICON, 0, 0, 0, Default, Default, "HANDLE")
    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[1][1], $GCL_HICON)
    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[1][1], $GCL_HICONSM)
    If $hIcon Then
    Local $hOldImage = _SendMessage(GUICtrlGetHandle($relatedwindows[1][2]), $BM_SETIMAGE , 1, $hIcon)
    GUICtrlSetData($relatedwindows[1][2],StringLeft ($relatedwindows[1][0],10))
    _SendMessage($winswitch, $WM_ERASEBKGND, $hDC_Window)
    _WinAPI_DestroyIcon($hOldImage)
    _WinAPI_DestroyIcon($hIcon)
    EndIf
    ;---> restliche "Kacheln"
    for $i = 2 to $j-1
    ;---> neue Zeile nach 4 Kacheln
    if $cnt = 4 Then
    $relatedwindows[$i][2] = GUICtrlCreateButton("", -328, -1 + $ygap, 90, 90, BitOr($BS_MULTILINE, $BS_PUSHLIKE))
    $cnt = 1

    $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 2, 0, 0, Default, Default, "HANDLE")
    If Not $hIcon Then $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 0, 0, 0, Default, Default, "HANDLE")
    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICON)
    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICONSM)
    If $hIcon Then
    Local $hOldImage = _SendMessage(GUICtrlGetHandle($relatedwindows[$i][2]), $BM_SETIMAGE , 1, $hIcon)
    GUICtrlSetData($relatedwindows[$i][2],StringLeft ($relatedwindows[$i][0],10))
    _SendMessage($winswitch, $WM_ERASEBKGND, $hDC_Window)
    _WinAPI_DestroyIcon($hOldImage)
    _WinAPI_DestroyIcon($hIcon)
    EndIf
    Else
    $relatedwindows[$i][2] = GUICtrlCreateButton("", -1 + 110, -1, 90, 90, BitOr($BS_MULTILINE, $BS_PUSHLIKE))
    $cnt = $cnt + 1

    $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 2, 0, 0, Default, Default, "HANDLE")
    If Not $hIcon Then $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 0, 0, 0, Default, Default, "HANDLE")
    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICON)
    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICONSM)
    If $hIcon Then
    Local $hOldImage = _SendMessage(GUICtrlGetHandle($relatedwindows[$i][2]), $BM_SETIMAGE , 1, $hIcon)
    GUICtrlSetData($relatedwindows[$i][2],StringLeft ($relatedwindows[$i][0],10))
    _SendMessage($winswitch, $WM_ERASEBKGND, $hDC_Window)
    _WinAPI_DestroyIcon($hOldImage)
    _WinAPI_DestroyIcon($hIcon)
    EndIf
    EndIf
    Next
    EndIf
    GUISetState()
    _WinAPI_SetLayeredWindowAttributes($winswitch, 0x01, 255)

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

    ;---> Falls keine Fester gefunden: Meldung für 3sec zeigen und dann beenden.
    If $j == 1 Then
    Sleep(3000)
    Exit
    EndIf

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

    While 1
    $msg = GUIGetMsg()
    WinSetOnTop($winswitch, "", 1)
    Switch $msg
    Case $GUI_EVENT_CLOSE
    Exit
    Case Else
    ;---> Auf Buttons lauschen
    for $i=1 to $j -1
    if $msg = ($relatedwindows[$i][2]) Then
    __PopUp($relatedwindows[$i][0])
    Exit
    EndIf
    Next

    EndSwitch
    WEnd
    ;---> PoUp mit Aktionen für gewähltes Fenster
    Func __PopUp($window)
    $position = GUICreate("", 338, 280, $guiX, -1, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetBkColor(0x01)
    ;==> Positions
    GUICtrlCreateGroup("", 25, 25, 290, 160)
    GUICtrlSetColor(-1, 0xffffff)
    GUICtrlCreateLabel(" Action ", 15, -8, 63, 25)
    GUICtrlSetFont(-1, 12, 500, 0, "Segoe UI")
    GUICtrlSetColor(-1, 0xffffff)
    $m1 = GUICtrlCreateButton("", -1, 30, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m1-gui.ico")
    $m2 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m2-gui.ico")
    $m3 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m3-gui.ico")
    $m12 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m12-gui.ico")
    $m23 = GUICtrlCreateButton("", -210, 70, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m23-gui.ico")
    $max = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\maximize-gui.ico")
    $min = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\minimize-gui.ico")
    $close = GUICtrlCreateButton("", 70, 0, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\close-gui.ico")
    $esc = GUICtrlCreateButton("cancel", -105, 90, 50, 50, BitOr($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
    _Gui_RoundCorners($position, 0, 0, 50, 50)
    GUISetState(@SW_SHOW)
    While 1
    $button = GUIGetMsg()
    Switch $button
    Case $GUI_EVENT_CLOSE
    Exit
    Case $m1
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m2
    WinActivate($window, "")
    $positionX = $m2X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m3
    WinActivate($window, "")
    $positionX = $m3X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m12
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $2thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m23
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $2thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $max
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $maxW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $min
    WinSetState($window, "", @SW_MINIMIZE)
    Exit
    Case $close
    WinClose($window, "")
    Exit
    Case $esc
    Return
    EndSwitch
    WEnd
    EndFunc

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

    Func _Gui_RoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
    Local $XS_pos, $XS_ret, $XS_ret2
    $XS_pos = WinGetPos($h_win)
    $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3)
    If $XS_ret[0] Then
    $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1)
    EndIf
    EndFunc

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

    Func _WinAPI_GetClassLongEx($hWnd, $iIndex)

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

    Local $Ret

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

    If @AutoItX64 Then
    $Ret = DllCall('user32.dll', 'ulong_ptr', 'GetClassLongPtrW', 'hwnd', $hWnd, 'int', $iIndex)
    Else
    $Ret = DllCall('user32.dll', 'ulong', 'GetClassLongW', 'hwnd', $hWnd, 'int', $iIndex)
    EndIf
    If (@error) Or (Not $Ret[0]) Then
    Return SetError(1, 0, 0)
    EndIf
    Return $Ret[0]
    EndFunc

    [/autoit]

    Und mein Interesse bzgl. Icons aus Programmdateien ist geweckt! Falls du also Zeit und Lust hast das nochmal rauszusuchen, schaue ich mir das sehr gerne an.
    Vielen Dank jedenfalls schonmal bis hierher :thumbup:

    • Offizieller Beitrag

    Schau dir mein Edit des letzten Posts an :D


    Edit: Hab für das Beispiel wieder ein bisschen Code von name22 geklaut ;) Thx name22. :thumbup:

    • Offizieller Beitrag

    name22
    Mach das :D

    @notna
    Edit: Hier mal der Scriptcode ein bisschen aufgeräumt und Icon aus EXE eingebaut

    Spoiler anzeigen
    [autoit]

    #region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Compile_Both=y
    #AutoIt3Wrapper_UseX64=y
    #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <WinAPI.au3>
    #include <Misc.au3>
    #include <Process.au3>
    _Singleton("switch", 0)

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

    Opt("GUICoordMode", 0)
    Opt("TrayIconHide", 1)

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

    Global Const $GCL_CBCLSEXTRA = -20
    Global Const $GCL_CBWNDEXTRA = -18
    Global Const $GCL_HBRBACKGROUND = -10
    Global Const $GCL_HCURSOR = -12
    Global Const $GCL_HICON = -14
    Global Const $GCL_HICONSM = -34
    Global Const $GCL_HMODULE = -16
    Global Const $GCL_MENUNAME = -8
    Global Const $GCL_STYLE = -26
    Global Const $GCL_WNDPROC = -24

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

    $allwindows = WinList()
    $count = $allwindows[0][0]
    Global $relatedwindows[$count][$count]
    $rows = 1
    $colums = 0
    $cnt = 1
    $j = 1
    $mouseX = MouseGetPos(0)
    Global $thirdW = @DesktopWidth / 3
    $third2 = (2 * $thirdW)
    $third3 = @DesktopWidth
    $x1 = ($thirdW / 2 - 332)
    $x2 = ($thirdW + $x1)
    $x3 = ($thirdW + $x2)
    Global $winH = @DesktopHeight
    Global $2thirdW = 2 * @DesktopWidth / 3
    Global $maxW = @DesktopWidth
    Global $m1X = 0
    Global $m2X = @DesktopWidth / 3
    Global $m3X = 2 * @DesktopWidth / 3
    ;;

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

    Global $guiW, $guiH; auf jeden Fall deklarieren, sonst mault AutoIt
    ;---> Positionsbestimmung
    If $mouseX <= $thirdW Then
    $guiX = $x1
    ElseIf $mouseX <= $third2 Then
    $guiX = $x2
    ElseIf $mouseX <= $third3 Then
    $guiX = $x3
    EndIf
    ;---> Fenster sammeln & Filtern. Anzahl von Zeilen & Spalten bestimmen.
    For $i = 1 To $count
    If (BitAND(WinGetState($allwindows[$i][1]), 16) Or WinGetState($allwindows[$i][1]) = 7) And $allwindows[$i][0] <> "Start" And $allwindows[$i][0] <> "Program Manager" And $allwindows[$i][0] <> "DWM Notification Window" And $allwindows[$i][0] <> "AMD:CCC-AEMCapturingWindow" And $allwindows[$i][0] <> "2. Client Starten" And $allwindows[$i][0] <> "SBSDKInstance" And $allwindows[$i][0] <> "" Then
    $relatedwindows[$j][0] = $allwindows[$i][0]
    $relatedwindows[$j][1] = $allwindows[$i][1]
    $colums = $colums + 1
    $j = $j + 1
    If $colums > 4 Then
    $colums = 1
    $rows = $rows + 1
    EndIf
    EndIf
    Next

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

    ;---> Maße der GUI gemäß Zeilen & Spalten
    If $j == 1 Then
    $guiW = 260
    ElseIf $j <= 4 Then
    $guiW = $j * 95
    Else
    $guiW = 500
    EndIf
    $guiH = ($rows * 120)
    $ygap = 120

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

    ;---> semitransparenter Hintergrund
    $background = GUICreate("", $guiW, $guiH, $guiX, -1, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetBkColor(0x01)
    _Gui_RoundCorners($background, 0, 0, 50, 50)
    WinSetTrans($background, "", 100)
    GUISetState()

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

    ;---> transparente GUI mit "Kacheln" für die Fenster
    $winswitch = GUICreate("Switch", $guiW, $guiH, $guiX, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
    GUISetBkColor(0x01)
    $hDC_Window = _WinAPI_GetDC($winswitch) ;---> DC für Icon extract...

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

    ;---> Meldung, falls keine Fenster geunden wurden...
    If $j == 1 Then
    GUICtrlCreateLabel("", 20, 40, 215, 35)
    GUICtrlSetBkColor(-1, 0x757273)
    GUICtrlCreateLabel("sorry, there are no windows...", 5, 5, 230, 25)
    GUICtrlSetFont(-1, 12, 500, 0, "Segoe UI")
    GUICtrlSetColor(-1, 0xffffff)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    Else
    ;Code aufgeräumt, es muß nicht 3 mal der selbe Code dastehen, es reicht die unterschiedliche Deklaration des Buttons

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

    For $i = 1 To $j - 1
    If $i = 1 Then ; Erster Button
    $relatedwindows[1][2] = GUICtrlCreateButton($relatedwindows[1][0], 40, 15, 90, 90, BitOR($BS_MULTILINE, $BS_PUSHLIKE))
    ElseIf $cnt = 4 Then; 4. Button in der Zeile
    $relatedwindows[$i][2] = GUICtrlCreateButton("", -328, -1 + $ygap, 90, 90, BitOR($BS_MULTILINE, $BS_PUSHLIKE))
    $cnt = 1
    Else
    $relatedwindows[$i][2] = GUICtrlCreateButton("", -1 + 110, -1, 90, 90, BitOR($BS_MULTILINE, $BS_PUSHLIKE))
    $cnt = $cnt + 1
    EndIf
    ;Hier ist die Deklaration zu Ende, der übrige Code bleibt gleich
    $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 2, 0, 0, Default, Default, "HANDLE")
    If Not $hIcon Then $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 0, 0, 0, Default, Default, "HANDLE")
    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICON)
    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICONSM)
    If Not $hIcon Then $hIcon = GetIconfromExe($relatedwindows[$i][0])
    GUICtrlSetData($relatedwindows[$i][2], StringLeft($relatedwindows[$i][0], 10));Buttontext einfügen, egal ob es ein Icon gibt !!!!

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

    If $hIcon Then
    Local $hOldImage = _SendMessage(GUICtrlGetHandle($relatedwindows[$i][2]), $BM_SETIMAGE, 1, $hIcon)
    _SendMessage($winswitch, $WM_ERASEBKGND, $hDC_Window)
    _WinAPI_DestroyIcon($hOldImage);Altes ButtonIcon zerstören
    _WinAPI_DestroyIcon($hIcon)
    EndIf
    Next
    EndIf
    GUISetState()
    _WinAPI_SetLayeredWindowAttributes($winswitch, 0x01, 255)

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

    ;---> Falls keine Fester gefunden: Meldung für 3sec zeigen und dann beenden.
    If $j == 1 Then
    Sleep(3000)
    Exit
    EndIf

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

    While 1
    $msg = GUIGetMsg()
    WinSetOnTop($winswitch, "", 1)
    Switch $msg
    Case $GUI_EVENT_CLOSE
    Exit
    Case Else
    ;---> Auf Buttons lauschen
    For $i = 1 To $j - 1
    If $msg = ($relatedwindows[$i][2]) Then
    __PopUp($relatedwindows[$i][0])
    Exit
    EndIf
    Next

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

    EndSwitch
    WEnd
    ;---> PoUp mit Aktionen für gewähltes Fenster
    Func __PopUp($window)
    $position = GUICreate("", 338, 280, $guiX, -1, $WS_POPUP, $WS_EX_TOPMOST, $background);Wenn diese Gui als vorderste liegen soll und die HauptGui nicht mehr anklickbar sein soll, Parent als letzten Parameter setzen.
    GUISetBkColor(0x01)
    ;==> Positions
    GUICtrlCreateGroup("", 25, 25, 290, 160)
    GUICtrlSetColor(-1, 0xffffff)
    GUICtrlCreateLabel(" Action ", 15, -8, 63, 25)
    GUICtrlSetFont(-1, 12, 500, 0, "Segoe UI")
    GUICtrlSetColor(-1, 0xffffff)
    $m1 = GUICtrlCreateButton("", -1, 30, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m1-gui.ico")
    $m2 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m2-gui.ico")
    $m3 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m3-gui.ico")
    $m12 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m12-gui.ico")
    $m23 = GUICtrlCreateButton("", -210, 70, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m23-gui.ico")
    $max = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\maximize-gui.ico")
    $min = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\minimize-gui.ico")
    $close = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\close-gui.ico")
    $esc = GUICtrlCreateButton("cancel", -105, 90, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
    _Gui_RoundCorners($position, 0, 0, 50, 50)
    GUISetState(@SW_SHOW)
    While 1
    $button = GUIGetMsg()
    Switch $button
    Case $GUI_EVENT_CLOSE
    Exit
    Case $m1
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m2
    WinActivate($window, "")
    $positionX = $m2X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m3
    WinActivate($window, "")
    $positionX = $m3X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m12
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $2thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m23
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $2thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $max
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $maxW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $min
    WinSetState($window, "", @SW_MINIMIZE)
    Exit
    Case $close
    WinClose($window, "")
    Exit
    Case $esc
    Return
    EndSwitch
    WEnd
    EndFunc ;==>__PopUp

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

    Func _Gui_RoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
    Local $XS_pos, $XS_ret, $XS_ret2
    $XS_pos = WinGetPos($h_win)
    $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3)
    If $XS_ret[0] Then
    $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1)
    EndIf
    EndFunc ;==>_Gui_RoundCorners

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

    Func _WinAPI_GetClassLongEx($hWnd, $iIndex)

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

    Local $Ret

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

    If @AutoItX64 Then
    $Ret = DllCall('user32.dll', 'ulong_ptr', 'GetClassLongPtrW', 'hwnd', $hWnd, 'int', $iIndex)
    Else
    $Ret = DllCall('user32.dll', 'ulong', 'GetClassLongW', 'hwnd', $hWnd, 'int', $iIndex)
    EndIf
    If (@error) Or (Not $Ret[0]) Then
    Return SetError(1, 0, 0)
    EndIf
    Return $Ret[0]
    EndFunc ;==>_WinAPI_GetClassLongEx

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

    Func GetIconfromExe($Title)
    Local $iIcons = 1; 1
    Local $PID = WinGetProcess($Title)
    Local $Prozessname = _ProcessGetName($PID)
    Local $AndwendungsPfad = _GetPathByPid($PID)
    ConsoleWrite($AndwendungsPfad & @LF)
    Local $t_ahIcons = DllStructCreate("HWND[" & $iIcons & "]") ;HWND Array um die Icons zu erhalten
    Local $p_ahIcons = DllStructGetPtr($t_ahIcons)
    _WinAPI_ExtractIconEx($AndwendungsPfad, 0, 0, $p_ahIcons, $iIcons)
    If Not @error Then Return DllStructGetData($t_ahIcons, 1, 1)
    ConsoleWrite("Error" & $AndwendungsPfad & @LF)
    Return 0
    EndFunc ;==>GetIconfromExe

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

    Func _GetPathByPid($iPID); gefunden im Englischen Forum , verfasser nicht bekannt.
    Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', 0x0410, 'int', 0, 'int', $iPID)
    If $aProc[0] = 0 Then Return SetError(1, 0, '')
    Local $vStruct = DllStructCreate('int[1024]')
    DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int_ptr', 0)
    Local $aReturn = DllCall('psapi.dll', 'int', 'GetModuleFileNameExW', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'wstr', '', 'int', 2048)
    If $aReturn[0] = 0 Then Return SetError(2, 0, '')
    Return $aReturn[3]
    EndFunc ;==>_GetPathByPid

    [/autoit]

    Wenn du kein 64 Bit BS hast, erste 4 Zeilen löschen
    Anmerkungen habe ich eingefügt

  • Schön wie viel Unterstützung man hier bekommt!!
    Die Funktion drei mal aufzurufen war wirklich nicht so besonders.. War ein bissl copy'n paste / trial'n error :S
    Werden bei euch die Icons von Explorerfenstern angezeigt? Scheinbar funktioniert GetIconfromExe nicht dabei.
    Ich möchte zwar nicht schleimen, aber der Support und Lernfaktor hier sind einfach vorbildlich :thumbup:
    Hoffentlich kann ich bals auch so konstruktiv zu dieser Community beitragen...

    • Offizieller Beitrag

    Was verstehst du unter Explorerfenster? Internet Explorer?

    Edit: Habe mal eingebaut, das bei Explorer.exe ein Ordnericon angezeigt wird.
    Du kannst auch jedes andere Icon aus der Shell32.dll oder einem andren Programm nehmen.

    Spoiler anzeigen
    [autoit]

    #region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Compile_Both=y
    #AutoIt3Wrapper_UseX64=y
    #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <WinAPI.au3>
    #include <Misc.au3>
    #include <Process.au3>
    _Singleton("switch", 0)

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

    Opt("GUICoordMode", 0)
    Opt("TrayIconHide", 1)

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

    Global Const $GCL_CBCLSEXTRA = -20
    Global Const $GCL_CBWNDEXTRA = -18
    Global Const $GCL_HBRBACKGROUND = -10
    Global Const $GCL_HCURSOR = -12
    Global Const $GCL_HICON = -14
    Global Const $GCL_HICONSM = -34
    Global Const $GCL_HMODULE = -16
    Global Const $GCL_MENUNAME = -8
    Global Const $GCL_STYLE = -26
    Global Const $GCL_WNDPROC = -24

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

    $allwindows = WinList()
    $count = $allwindows[0][0]
    Global $relatedwindows[$count][$count]
    $rows = 1
    $colums = 0
    $cnt = 1
    $j = 1
    $mouseX = MouseGetPos(0)
    Global $thirdW = @DesktopWidth / 3
    $third2 = (2 * $thirdW)
    $third3 = @DesktopWidth
    $x1 = ($thirdW / 2 - 332)
    $x2 = ($thirdW + $x1)
    $x3 = ($thirdW + $x2)
    Global $winH = @DesktopHeight
    Global $2thirdW = 2 * @DesktopWidth / 3
    Global $maxW = @DesktopWidth
    Global $m1X = 0
    Global $m2X = @DesktopWidth / 3
    Global $m3X = 2 * @DesktopWidth / 3
    ;;

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

    Global $guiW, $guiH; auf jeden Fall deklarieren, sonst mault AutoIt
    ;---> Positionsbestimmung
    If $mouseX <= $thirdW Then
    $guiX = $x1
    ElseIf $mouseX <= $third2 Then
    $guiX = $x2
    ElseIf $mouseX <= $third3 Then
    $guiX = $x3
    EndIf
    ;---> Fenster sammeln & Filtern. Anzahl von Zeilen & Spalten bestimmen.
    For $i = 1 To $count
    If (BitAND(WinGetState($allwindows[$i][1]), 16) Or WinGetState($allwindows[$i][1]) = 7) And $allwindows[$i][0] <> "Start" And $allwindows[$i][0] <> "Program Manager" And $allwindows[$i][0] <> "DWM Notification Window" And $allwindows[$i][0] <> "AMD:CCC-AEMCapturingWindow" And $allwindows[$i][0] <> "2. Client Starten" And $allwindows[$i][0] <> "SBSDKInstance" And $allwindows[$i][0] <> "" Then
    $relatedwindows[$j][0] = $allwindows[$i][0]
    $relatedwindows[$j][1] = $allwindows[$i][1]
    $colums = $colums + 1
    $j = $j + 1
    If $colums > 4 Then
    $colums = 1
    $rows = $rows + 1
    EndIf
    EndIf
    Next

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

    ;---> Maße der GUI gemäß Zeilen & Spalten
    If $j == 1 Then
    $guiW = 260
    ElseIf $j <= 4 Then
    $guiW = $j * 95
    Else
    $guiW = 500
    EndIf
    $guiH = ($rows * 120)
    $ygap = 120

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

    ;---> semitransparenter Hintergrund
    $background = GUICreate("", $guiW, $guiH, $guiX, -1, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetBkColor(0x01)
    _Gui_RoundCorners($background, 0, 0, 50, 50)
    WinSetTrans($background, "", 100)
    GUISetState()

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

    ;---> transparente GUI mit "Kacheln" für die Fenster
    $winswitch = GUICreate("Switch", $guiW, $guiH, $guiX, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
    GUISetBkColor(0x01)
    $hDC_Window = _WinAPI_GetDC($winswitch) ;---> DC für Icon extract...

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

    ;---> Meldung, falls keine Fenster geunden wurden...
    If $j == 1 Then
    GUICtrlCreateLabel("", 20, 40, 215, 35)
    GUICtrlSetBkColor(-1, 0x757273)
    GUICtrlCreateLabel("sorry, there are no windows...", 5, 5, 230, 25)
    GUICtrlSetFont(-1, 12, 500, 0, "Segoe UI")
    GUICtrlSetColor(-1, 0xffffff)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    Else
    ;Code aufgeräumt, es muß nicht 3 mal der selbe Code dastehen, es reicht die unterschiedliche Deklaration des Buttons

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

    For $i = 1 To $j - 1
    If $i = 1 Then ; Erster Button
    $relatedwindows[1][2] = GUICtrlCreateButton($relatedwindows[1][0], 40, 15, 90, 90, BitOR($BS_MULTILINE, $BS_PUSHLIKE))
    ElseIf $cnt = 4 Then; 4. Button in der Zeile
    $relatedwindows[$i][2] = GUICtrlCreateButton("", -328, -1 + $ygap, 90, 90, BitOR($BS_MULTILINE, $BS_PUSHLIKE))
    $cnt = 1
    Else
    $relatedwindows[$i][2] = GUICtrlCreateButton("", -1 + 110, -1, 90, 90, BitOR($BS_MULTILINE, $BS_PUSHLIKE))
    $cnt = $cnt + 1
    EndIf
    ;Hier ist die Deklaration zu Ende, der übrige Code bleibt gleich
    $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 2, 0, 0, Default, Default, "HANDLE")
    If Not $hIcon Then $hIcon = _SendMessage($relatedwindows[$i][1], $WM_GETICON, 0, 0, 0, Default, Default, "HANDLE")
    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICON)
    If Not $hIcon Then $hIcon = _WinAPI_GetClassLongEx($relatedwindows[$i][1], $GCL_HICONSM)
    If Not $hIcon Then $hIcon = GetIconfromExe($relatedwindows[$i][0])
    GUICtrlSetData($relatedwindows[$i][2], StringLeft($relatedwindows[$i][0], 10));Buttontext einfügen, egal ob es ein Icon gibt !!!!

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

    If $hIcon Then
    Local $hOldImage = _SendMessage(GUICtrlGetHandle($relatedwindows[$i][2]), $BM_SETIMAGE, 1, $hIcon)
    _SendMessage($winswitch, $WM_ERASEBKGND, $hDC_Window)
    _WinAPI_DestroyIcon($hOldImage);Altes ButtonIcon zerstören
    _WinAPI_DestroyIcon($hIcon)
    EndIf
    Next
    EndIf
    GUISetState()
    _WinAPI_SetLayeredWindowAttributes($winswitch, 0x01, 255)

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

    ;---> Falls keine Fester gefunden: Meldung für 3sec zeigen und dann beenden.
    If $j == 1 Then
    Sleep(3000)
    Exit
    EndIf

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

    While 1
    $msg = GUIGetMsg()
    WinSetOnTop($winswitch, "", 1)
    Switch $msg
    Case $GUI_EVENT_CLOSE
    Exit
    Case Else
    ;---> Auf Buttons lauschen
    For $i = 1 To $j - 1
    If $msg = ($relatedwindows[$i][2]) Then
    __PopUp($relatedwindows[$i][0])
    Exit
    EndIf
    Next

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

    EndSwitch
    WEnd
    ;---> PoUp mit Aktionen für gewähltes Fenster
    Func __PopUp($window)
    $position = GUICreate("", 338, 280, $guiX, -1, $WS_POPUP, $WS_EX_TOPMOST, $background);Wenn diese Gui als vorderste liegen soll und die HauptGui nicht mehr anklickbar sein soll, Parent als letzten Parameter setzen.
    GUISetBkColor(0x01)
    ;==> Positions
    GUICtrlCreateGroup("", 25, 25, 290, 160)
    GUICtrlSetColor(-1, 0xffffff)
    GUICtrlCreateLabel(" Action ", 15, -8, 63, 25)
    GUICtrlSetFont(-1, 12, 500, 0, "Segoe UI")
    GUICtrlSetColor(-1, 0xffffff)
    $m1 = GUICtrlCreateButton("", -1, 30, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m1-gui.ico")
    $m2 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m2-gui.ico")
    $m3 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m3-gui.ico")
    $m12 = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m12-gui.ico")
    $m23 = GUICtrlCreateButton("", -210, 70, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\m23-gui.ico")
    $max = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\maximize-gui.ico")
    $min = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\minimize-gui.ico")
    $close = GUICtrlCreateButton("", 70, 0, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetImage(-1, @ScriptDir & "\GUI\close-gui.ico")
    $esc = GUICtrlCreateButton("cancel", -105, 90, 50, 50, BitOR($BS_MULTILINE, $BS_PUSHLIKE, $BS_ICON))
    GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
    _Gui_RoundCorners($position, 0, 0, 50, 50)
    GUISetState(@SW_SHOW)
    While 1
    $button = GUIGetMsg()
    Switch $button
    Case $GUI_EVENT_CLOSE
    Exit
    Case $m1
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m2
    WinActivate($window, "")
    $positionX = $m2X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m3
    WinActivate($window, "")
    $positionX = $m3X
    $positionW = $thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m12
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $2thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $m23
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $2thirdW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $max
    WinActivate($window, "")
    $positionX = $m1X
    $positionW = $maxW
    WinMove($window, "", $positionX, 0, $positionW, $winH, 3)
    Exit
    Case $min
    WinSetState($window, "", @SW_MINIMIZE)
    Exit
    Case $close
    WinClose($window, "")
    Exit
    Case $esc
    Return
    EndSwitch
    WEnd
    EndFunc ;==>__PopUp

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

    Func _Gui_RoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
    Local $XS_pos, $XS_ret, $XS_ret2
    $XS_pos = WinGetPos($h_win)
    $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3)
    If $XS_ret[0] Then
    $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1)
    EndIf
    EndFunc ;==>_Gui_RoundCorners

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

    Func _WinAPI_GetClassLongEx($hWnd, $iIndex)

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

    Local $Ret

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

    If @AutoItX64 Then
    $Ret = DllCall('user32.dll', 'ulong_ptr', 'GetClassLongPtrW', 'hwnd', $hWnd, 'int', $iIndex)
    Else
    $Ret = DllCall('user32.dll', 'ulong', 'GetClassLongW', 'hwnd', $hWnd, 'int', $iIndex)
    EndIf
    If (@error) Or (Not $Ret[0]) Then
    Return SetError(1, 0, 0)
    EndIf
    Return $Ret[0]
    EndFunc ;==>_WinAPI_GetClassLongEx

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

    Func GetIconfromExe($Title)
    Local $iIcons = 1; 1
    Local $t_ahIcons = DllStructCreate("HWND[" & $iIcons & "]") ;HWND Array um die Icons zu erhalten
    Local $p_ahIcons = DllStructGetPtr($t_ahIcons)
    Local $PID = WinGetProcess($Title)
    Local $Prozessname = _ProcessGetName($PID)
    Local $AndwendungsPfad = _GetPathByPid($PID)
    If $AndwendungsPfad <> @WindowsDir & "\Explorer.exe" Then
    _WinAPI_ExtractIconEx($AndwendungsPfad, 0, 0, $p_ahIcons, $iIcons)
    If Not @error Then Return DllStructGetData($t_ahIcons, 1, 1)
    Return 0
    Else; Fenster gehört zu Explorer.exe geladen wird dabei das 4. ICon aus der shell32.dll. ggF. kann auch ein anderes verwendet werde.
    ;Explorer.exe hat kein eigenes Icon
    _WinAPI_ExtractIconEx(@SystemDir & "\shell32.dll", 4, 0, $p_ahIcons, $iIcons)
    If Not @error Then Return DllStructGetData($t_ahIcons, 1, 1)
    Return 0
    EndIf
    EndFunc ;==>GetIconfromExe

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

    Func _GetPathByPid($iPID); gefunden im Englischen Forum , verfasser nicht bekannt.
    Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', 0x0410, 'int', 0, 'int', $iPID)
    If $aProc[0] = 0 Then Return SetError(1, 0, '')
    Local $vStruct = DllStructCreate('int[1024]')
    DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int_ptr', 0)
    Local $aReturn = DllCall('psapi.dll', 'int', 'GetModuleFileNameExW', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'wstr', '', 'int', 2048)
    If $aReturn[0] = 0 Then Return SetError(2, 0, '')
    Return $aReturn[3]
    EndFunc ;==>_GetPathByPid

    [/autoit]
  • Raupi rockt :rock:
    Vielen Dank!!! Ich musste bei mir nur die If Abfrage in der GetIconfromExe von

    [autoit]

    If $AndwendungsPfad <> @WindowsDir & "\Explorer.exe" Then

    [/autoit]


    in

    [autoit]

    If $Prozessname <> "explorer.exe" Then

    [/autoit]


    ändern, damit es funktioniert. Arbeite in einer VM, evtl. liegt's ja daran. Habe dann noch das 202. Icon aus imageres.dll für das Win7 Explorer Fenster wie in der Taskleiste genommen... Feine Sache! Ich bin kein Win-User und kenne mich mit dem System daher ähnlich gut aus wie mit Autoit. Wede mich übers Wochende mal intensiver vor die Funktionen setzten, damit ich (hoffentlich) mal besser verstehe was da passiert :D

    Edit: Habe noch ein bissl kosmetik gemacht, die aktuelle Version in den ersten Beitrag gepackt und den Thread auf "gelöst" gesetzt.

    Einmal editiert, zuletzt von notna (7. Juni 2013 um 12:09)