Fenster im Kreis bewegen [ehemals: Druch Gui durchklicken]

  • Hi, hab nen script das eine Gui erstellt mir einem Smily drinne, der immer der Maus Folgt, nur hab nur das Problem das wenn ich nen Mausklick mache immer auf die Gui klicke und nicht dahin wo ich hin will, gibt es da irgendwie eine Lösung?

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    $hGui = GUICreate ("Smily",15,15,0,0,-2147483648+0x08000000,$WS_EX_LAYERED+0x00000080+0x00000008)
    GUISetBkColor (0x000000)
    $hBmp = GUICtrlCreatePic ("i.bmp",0,0,15,15)
    DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hGui, "long", 0x000000, "byte", 255, "long", 0x03)
    GUISetState (@SW_SHOW)

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

    While 1
    Switch GUIGetMsg ()
    Case -3
    Exit
    EndSwitch
    Sleep (1)
    $Pos = MouseGetPos()
    WinMove ($hGui,"",$Pos[0]-7,$Pos[1]-7)
    WEnd

    [/autoit]
  • Okay, jetzt komm kein Fehler mehr, aber es funktioniert auch nicht, das einzige was passiert sit das meine transparenz nicht emhr stimmt und ich wieder einen schwarzen rand habe

    Spoiler anzeigen
    [autoit]

    #include <Constants.au3>
    #include <WindowsConstants.au3>
    #Include <WinAPI.au3>

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

    $hGui = GUICreate ("Smily",15,15,0,0,-2147483648+0x08000000,$WS_EX_LAYERED+0x00000080+0x00000008)
    GUISetBkColor (0x000000)
    $hBmp = GUICtrlCreatePic ("i.bmp",0,0,15,15)
    DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hGui, "long", 0x000000, "byte", 255, "long", 0x03)
    GUISetState (@SW_SHOW)

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

    _Win_SetClickThrough ($hGui)
    While 1
    Switch GUIGetMsg ()
    Case -3
    Exit
    EndSwitch
    Sleep (1)
    $Pos = MouseGetPos()
    WinMove ($hGui,"",$Pos[0] -7,$Pos[1] -7)
    WEnd
    ;
    ; Function Name: _Win_SetClickThrough($hWnd,$noclic = True)
    ; Description:: Makes a window to not receive mouse input
    ; Parameter(s): $title -> Title or hWnd of Window
    ; $text [Optional] -> Text in Window
    ; $noclic [Optional] -> If False, the window regains MouseInput otherwise it will loose it, defalut: True
    ; Requirement(s): <WINApi.au3>
    ; Return Value(s): Success: 1, Error0 and @error
    ; @error Values: 1 -> Window does not exist
    ; 2 -> Error in Setting the Styles
    ; Author(s): Prog@ndy
    ;
    ;===============================================================================
    ;
    Func _Win_SetClickThrough($title,$text = "",$noclic = True)
    Local $hWnd = WinGetHandle($title,$text)
    If @error Then Return SetError(1,0,0)
    If $noclic Then
    _WinAPI_SetWindowLong($hWnd,$GWL_EXSTYLE,BitOR(_WinAPI_GetWindowLong($hWnd,$GWL_EXSTYLE),$WS_EX_TRANSPARENT))
    If @error Then Return SetError(2,0,0)
    WinSetTrans($hWnd,"",255) ; Sets the Layered Attribute, but still shows the window :)
    If @error Then Return SetError(2,0,0)
    Else
    _WinAPI_SetWindowLong($hWnd,$GWL_EXSTYLE,BitAND(_WinAPI_GetWindowLong($hWnd,$GWL_EXSTYLE),BitNOT($WS_EX_TRANSPARENT)))
    If @error Then Return SetError(2,0,0)
    EndIf
    Return 1
    EndFunc
    ;### UDF END

    [/autoit]

    mfg. Jam00

  • Oki, habe es selber hinbekommen

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include <Constants.au3>
    #include <WindowsConstants.au3>
    #Include <WinAPI.au3>
    $hGui = GUICreate ("Smily",15,15,0,0,-2147483648+0x08000000,$WS_EX_LAYERED+0x00000080+0x00000008)
    GUISetBkColor (0x000000)
    $hBmp = GUICtrlCreatePic ("i.bmp",0,0,15,15)
    DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hGui, "long", 0x000000, "byte", 255, "long", 0x03)
    GUISetState (@SW_SHOW)

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

    _Win_SetClickThrough ($hGui)
    While 1
    Switch GUIGetMsg ()
    Case -3
    Exit
    EndSwitch
    Sleep (1)
    $Pos = MouseGetPos()
    WinMove ($hGui,"",($Pos[0]-7),($Pos[1]-7))
    WEnd

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

    ;===============================================================================
    ;
    ; Function Name: _Win_SetClickThrough($hWnd,$noclic = True)
    ; Description:: Makes a window to not receive mouse input
    ; Parameter(s): $title -> Title or hWnd of Window
    ; $text [Optional] -> Text in Window
    ; $noclic [Optional] -> If False, the window regains MouseInput otherwise it will loose it, defalut: True
    ; Requirement(s): <WINApi.au3>
    ; Return Value(s): Success: 1, Error0 and @error
    ; @error Values: 1 -> Window does not exist
    ; 2 -> Error in Setting the Styles
    ; Author(s): Prog@ndy
    ;
    ;===============================================================================
    ;
    Func _Win_SetClickThrough($title,$text = "",$noclic = True)
    Local $hWnd = WinGetHandle($title,$text)
    If @error Then Return SetError(1,0,0)
    If $noclic Then
    _WinAPI_SetWindowLong($hWnd,$GWL_EXSTYLE,BitOR(_WinAPI_GetWindowLong($hWnd,$GWL_EXSTYLE),$WS_EX_TRANSPARENT))
    If @error Then Return SetError(2,0,0)
    ;~ WinSetTrans($hWnd,"",255) ; Sets the Layered Attribute, but still shows the window :)
    If @error Then Return SetError(2,0,0)
    Else
    _WinAPI_SetWindowLong($hWnd,$GWL_EXSTYLE,BitAND(_WinAPI_GetWindowLong($hWnd,$GWL_EXSTYLE),BitNOT($WS_EX_TRANSPARENT)))
    If @error Then Return SetError(2,0,0)
    EndIf
    Return 1
    EndFunc
    ;### UDF END

    [/autoit]

    aber jetzt habe ich ein neues Prob:
    Ich wollte das sich der Smily jetzt um den Mauszeiger dreht, aber das bekomm ich ent hin, habe es so probiert

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include <Constants.au3>
    #include <WindowsConstants.au3>
    #Include <WinAPI.au3>
    $hGui = GUICreate ("Smily",15,15,0,0,-2147483648+0x08000000,$WS_EX_LAYERED+0x00000080+0x00000008)
    GUISetBkColor (0x000000)
    $hBmp = GUICtrlCreatePic ("i.bmp",0,0,15,15)
    DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hGui, "long", 0x000000, "byte", 255, "long", 0x03)
    GUISetState (@SW_SHOW)

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

    Dim $Kreis[14][2]
    $Count = 0
    $Kreis[0][0] = 10
    $Kreis[0][1] = 0
    $Kreis[1][0] = 10
    $Kreis[1][1] = 1
    $Kreis[2][0] = 10
    $Kreis[2][1] = 2
    $Kreis[3][0] = 9
    $Kreis[3][1] = 3
    $Kreis[4][0] = 9
    $Kreis[4][1] = 4
    $Kreis[5][0] = 8
    $Kreis[5][1] = 5
    $Kreis[6][0] = 7
    $Kreis[6][1] = 6
    $Kreis[7][0] = 5
    $Kreis[7][1] = 7
    $Kreis[8][0] = 5
    $Kreis[8][1] = 8
    $Kreis[9][0] = 4
    $Kreis[9][1] = 8
    $Kreis[10][0] = 3
    $Kreis[10][1] = 9
    $Kreis[11][0] = 2
    $Kreis[11][1] = 9
    $Kreis[12][0] = 1
    $Kreis[12][1] = 9
    $Kreis[13][0] = 0
    $Kreis[13][1] = 9
    AdlibRegister ("_Count",20)
    _Win_SetClickThrough ($hGui)
    While 1
    Switch GUIGetMsg ()
    Case -3
    Exit
    EndSwitch
    Sleep (1)
    $Pos = MouseGetPos()
    WinMove ($hGui,"",($Pos[0]-7),($Pos[1]-7))
    If $Count < 14 Then
    WinMove ($hGui,"",($Pos[0]-7) + $Kreis[$Count][0],($Pos[1]-7) + $Kreis[$Count][1])
    ElseIf $Count < 27 Then
    WinMove ($hGui,"",($Pos[0]-7) - $Kreis[$Count-13][0],($Pos[1]-7) - $Kreis[$Count-13][1])
    ElseIf $Count < 40 Then
    WinMove ($hGui,"",($Pos[0]-7) + $Kreis[$Count-26][0],($Pos[1]-7) - $Kreis[$Count-26][1])
    ElseIf $Count < 53 Then
    WinMove ($hGui,"",($Pos[0]-7) - $Kreis[$Count-39][0],($Pos[1]-7) + $Kreis[$Count-39][1])
    EndIf
    WEnd
    Func _Count()
    $Count +=1
    If $Count > 53 Then $Count = 0
    EndFunc
    ;~ ;### UDF Start

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

    ;===============================================================================
    ;
    ; Function Name: _Win_SetClickThrough($hWnd,$noclic = True)
    ; Description:: Makes a window to not receive mouse input
    ; Parameter(s): $title -> Title or hWnd of Window
    ; $text [Optional] -> Text in Window
    ; $noclic [Optional] -> If False, the window regains MouseInput otherwise it will loose it, defalut: True
    ; Requirement(s): <WINApi.au3>
    ; Return Value(s): Success: 1, Error0 and @error
    ; @error Values: 1 -> Window does not exist
    ; 2 -> Error in Setting the Styles
    ; Author(s): Prog@ndy
    ;
    ;===============================================================================
    ;
    Func _Win_SetClickThrough($title,$text = "",$noclic = True)
    Local $hWnd = WinGetHandle($title,$text)
    If @error Then Return SetError(1,0,0)
    If $noclic Then
    _WinAPI_SetWindowLong($hWnd,$GWL_EXSTYLE,BitOR(_WinAPI_GetWindowLong($hWnd,$GWL_EXSTYLE),$WS_EX_TRANSPARENT))
    If @error Then Return SetError(2,0,0)
    ;~ WinSetTrans($hWnd,"",255) ; Sets the Layered Attribute, but still shows the window :)
    If @error Then Return SetError(2,0,0)
    Else
    _WinAPI_SetWindowLong($hWnd,$GWL_EXSTYLE,BitAND(_WinAPI_GetWindowLong($hWnd,$GWL_EXSTYLE),BitNOT($WS_EX_TRANSPARENT)))
    If @error Then Return SetError(2,0,0)
    EndIf
    Return 1
    EndFunc
    ;### UDF END

    [/autoit]

    Aber das funktionier ja auch noch ent so ganz

    THX im forraus

    mfg. Jam00

  • Ich glaube du suchst diese Formel:

    Spoiler anzeigen
    [autoit]

    Global Const $Pi_Div_180 = 4 * ATan(1) / 180

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

    $Angle = 0 ;Startwinkel in °
    $iRadius = 50 ;Radius des Kreises um den sich der Smiley dreht

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

    While 1
    $MousePos = MouseGetPos()
    $iX = $MousePos[0] + Cos(($Angle - 90) * $Pi_Div_180) * $iRadius
    $iY = $MousePos[1] + Sin(($Angle - 90) * $Pi_Div_180) * $iRadius
    $Angle += 5
    Sleep(10)
    WEnd

    [/autoit]


    Ich hoffe du verstehst was ich meine :D.