Toolbar an die Statusleiste anheften!?

  • Hi @all

    erstmal das ist ein super Forum hier und ich konnte schon mit Hilfe der Beiträge hier viele Probleme von mir Lösen aber im mom komm ich einfach nicht weiter.


    zu Problem 1:

    Ich hab eine Toolbar geschrieben, die je nachdem welcher Button gedrückt wird das Aktuelle Fenster in den linken oder rechten Monitor geschickt werden. Der Teil läuft auch. Jetzt will ich aber das diese Toolbar immer am aktiven Fenster hängt an einer festen Position und das bekomm ich nicht hin...


    Spoiler anzeigen
    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    Opt ("TrayIconHide", 1)
    Opt("WinTitleMatchMode", 2)
    $cmdline[1]=$posX
    $cmdline[2]=$posY
    $form1 = GUICreate("Toolbar", 60, 17,$posX,$posY,$WS_POPUP,BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST))
    $Button1 = GUICtrlCreateIcon("links.ico", "links",45,1,16,16)
    $Button2 = GUICtrlCreateIcon("rechts.ico", "rechts", 1, 1, 16, 16)
    $button3 = GUICtrlCreateIcon("beide.ico", "beide", 22, 1, 16, 16)
    GUISetState(@SW_SHOW)

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

    While ProcessExists("DiBaTray.exe")
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1 ;hier bestimmst du welcher button in diesem fall eben button1
    _WINMOVE_LEFT () ;Hier bestimmst du wie die Funktion heisst die bei einem klick auf dem Button1 aus geführt wird
    Case $Button2 ;hier bestimmst du welcher button in diesem fall eben button2
    _WINMOVE_RIGHT ()
    Case $Button3
    _WINSPREAD ()
    EndSwitch
    WEnd

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

    Func _WINMOVE_RIGHT ()
    send("!{TAB}")
    $size = WinGetPos("[active]")
    $state = WinGetState ("[active]")
    $title = WinGetTitle ("[active]")
    $LeftMoni = 1280
    $RightMoni = 1280
    ;MsgBox(0,"info", $state,"")
    Select
    Case $state == 47
    Select
    Case $size[0] < 1275
    ;MsgBox(0,"info", $size[0],"")
    WinSetState ("[active]","",@SW_Restore)
    WinMove ("[active]","", $size[0]+$RightMoni,$size[1])
    WinSetState ("[active]","",@SW_SHOWMAXIMIZED)
    Case $size[0] > 1275
    ;MsgBox(0,"info", $size[0],"")
    WinSetState ("[active]","",@SW_Restore)
    WinMove ("[active]","",1920,0,640,1024)
    ;WinSetState ("[active]","",@SW_SHOWMAXIMIZED)
    EndSelect
    Case $state < 46
    Select
    Case $size[0] < 1275
    ;MsgBox(0,"info", $size[0],"")
    WinMove ("[active]","", $size[0]+$RightMoni,$size[1])
    WinSetState ("[active]","",@SW_ENABLE)
    Case $size[0] >= 1275
    ;MsgBox(0,"info", $size[0],"")
    WinMove ("[active]","",1920,0,640,1024)
    WinSetState ("[active]","",@SW_ENABLE)
    EndSelect
    EndSelect
    EndFunc

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

    Func _WINMOVE_LEFT ()
    send("!{TAB}")
    $title = WinGetTitle ("[active]")
    $titleold= $title
    $size = WinGetPos("[active]")
    $state = WinGetState ("[active]")
    $LeftMoni = 1280
    $RightMoni = 1280
    ;MsgBox(0,"info", $state,"")
    Select
    Case $state == 47
    Select
    Case $size[0] < 1275
    ;MsgBox(0,"info", $size[0],"")
    WinSetState ("[active]","",@SW_Restore)
    WinMove ("[active]","",0,0,640,970)
    ;WinSetState ("[active]","",@SW_SHOWMAXIMIZED)
    Case $size[0] > 1275
    ;MsgBox(0,"info", $size[0],"")
    WinSetState ("[active]","",@SW_Restore)
    WinMove ("[active]","", $size[0]-$LeftMoni,$size[1])
    WinSetState ("[active]","",@SW_SHOWMAXIMIZED)
    EndSelect
    Case $state < 46
    Select
    Case $size[0] < 1275
    ;MsgBox(0,"info", $size[0],"")
    WinMove ("[active]","",0,0,640,970)
    WinSetState ("[active]","",@SW_ENABLE)
    Case $size[0] >= 1275
    ;MsgBox(0,"info", $size[0],"")
    WinMove ("[active]","", $size[0]-$LeftMoni,$size[1])
    WinSetState ("[active]","",@SW_ENABLE)
    EndSelect
    EndSelect
    ;Else
    ;MsgBox (0, "Fensterstatus", "Das Fenster ist nicht maximiert. " & $maxi, "")
    ;EndIf
    EndFunc

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

    Func _WINSPREAD ()
    send("!{TAB}")
    $state = WinGetState ("[active]")
    $title = WinGetTitle ("[active]")
    $size = WinGetPos("[active]")
    Select
    Case $size[2] <= 1288
    ;MsgBox (0, "Size",$size[2],"")
    WinSetState ("[active]","",@SW_Restore)
    WinMove ($title ,"",1, 1, 2559, 970)
    Case $size[2] >= 1288
    ;MsgBox (0, "Size",$size[2],"")
    WinSetState ("[active]","",@SW_Restore)
    WinMove ($title ,"",1,1,800,600)
    WinSetState ("[active]","",@SW_MAXIMIZE)
    EndSelect
    EndFunc

    [/autoit]

    und das 2te Problem:

    Hier das Problem ist, dass ich das gleiche wie mit der Toolbar mit dem Mausklick realisieren will. Das geht allerdings voll in die Hose....


    hier mein Ansatz...

    [autoit]

    ;Mousklick
    $posmouse= MouseGetPos()
    While 1
    If _IsPressed("04") AND $posmouse[0]==0 AND $posmouse[1]==0 Then
    Send("#{LEFT}")
    ElseIf _IsPressed("04") AND $posmouse[0]==2559 AND $posmouse[1]==0 Then
    Send("#{RIGHT} ")
    EndIf
    WEnd

    [/autoit]


    Ich hoffe ihr könnt mir helfen.


    mfg


    Peet

    3 Mal editiert, zuletzt von Peet47 (14. Mai 2010 um 14:11)

  • Ersteinmal: Herzlich Willkommen im Forum ;)

    Musste mich erstmal etwas durchkämpfen was du überhaupt willst

    Problem 2:

    Spoiler anzeigen
    [autoit]

    ;Mousklick
    While 1
    If _IsPressed("04") Then
    $posmouse = MouseGetPos()
    If $posmouse[0] = 0 And $posmouse[1] = 0 Then
    Send("#{LEFT}")
    ElseIf $posmouse[0] = 2559 And $posmouse[1] = 0 Then; Statt 2559 evtl mit @DesktopWidth arbeiten?
    Send("#{RIGHT} ")
    EndIf
    EndIf
    WEnd

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

    ; alternativ auch so: (gefällt mir besser)

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

    While 1
    If _IsPressed("04") And Not MouseGetPos(1) Then ; and not bedeutet soviel wie MouseGetPos(1) muss endweder 0 oder "" sein
    Switch MouseGetPos(0)
    Case 0
    Send("#{LEFT}")
    Case 2559 ; Statt 2559 evtl mit @DesktopWidth arbeiten?
    Send("#{RIGHT} ")
    EndSwitch
    EndIf
    WEnd

    [/autoit]

    zu problem 1 komm ich leider nichtmehr...
    muss weg

  • Vielen dank.

    Jetzt seh ich auch meinen Fehler...


    zu meine ersten Problem, falls unklar ist was ich da machen will?! Ich hab ne GUI gebastelt und diese soll in jedem aktiven Fenster an einer Position angehaftet werden und dort auch bleiben egal wo das aktive Fenster ist.


    bzw. ich will das [Blockierte Grafik: http://s5.directupload.net/images/100505/qi2spiau.png] aber mit eigenen Funktionen.

  • Hi @all


    mittlerweile bin ich etwas weiter gekommen, bringt allerdings noch ein paar kleine Fehler die ich nicht finde....


    Vielleicht findet einer von euch den Fehler :?: :!:

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_icon=favoris'Box.ico
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    ; Opt ("TrayIconHide", 1)
    Opt("WinTitleMatchMode", 2)

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

    While 1
    Sleep (10)
    $title = WinGetTitle("[active]")
    $state = WinGetState("[active]")
    $size = WinGetPos("[active]")

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

    If $title<>WinGetTitle("[active]") Or $size<>WinGetPos("[active]") Or $title<>"Toolbar" Or ControlEnable("classname=Shell_TrayWnd", "", "ToolbarWindow321")<>1 Or ControlEnable("classname=Shell_TrayWnd", "", "ToolbarWindow322")<>1 Or ControlEnable("classname=Shell_TrayWnd", "", "ToolbarWindow323")<>1 Or ControlEnable("classname=Shell_TrayWnd", "", "Button1")<>1 Then
    GUIDelete()
    Sleep (10)
    $titleold = WinGetTitle("[active]")
    $state = WinGetState("[active]")
    $sizeold = WinGetPos("[active]")
    GUICreate("Toolbar", 60, 20,$size[0]+$size[2]-120,$size[1]+1,$WS_POPUP,BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST))
    $Button1 = GUICtrlCreateIcon("links.ico", "links",45,1,16,16)
    $Button2 = GUICtrlCreateIcon("rechts.ico", "rechts", 1, 1, 16, 16)
    $button3 = GUICtrlCreateIcon("beide.ico", "beide", 22, 1, 16, 16)
    Sleep(10)

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

    EndIf
    GUISetState()
    WinActivate($titleold)

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

    While $title="Toolbar" OR $titleold = WinGetTitle("[active]")
    $title = WinGetTitle("[active]")
    $size = WinGetPos("[active]")
    Sleep (10)
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1 ;hier bestimmst du welcher button in diesem fall eben button1
    _WINMOVE_LEFT () ;Hier bestimmst du wie die Funktion heisst die bei einem klick auf dem Button1 aus geführt wird
    ExitLoop
    Case $Button2 ;hier bestimmst du welcher button in diesem fall eben button2
    _WINMOVE_RIGHT ()
    ExitLoop
    Case $Button3
    _WINSPREAD ()
    ExitLoop
    EndSwitch
    If $size[1] <> $sizeold[1] Then
    GUISetState(@SW_HIDE)
    If MouseClick("left") Then
    Sleep (1000)
    EndIf
    Sleep(10)
    ExitLoop
    EndIf
    WEnd

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

    WEnd

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

    Func _WINMOVE_RIGHT ()
    $size = WinGetPos($titleold)
    $state = WinGetState ($titleold)
    $LeftMoni = 1280
    $RightMoni = 1280
    ;MsgBox(0,"info", $state,"")
    Select
    Case $state == 47
    Select
    Case $size[0] < 1275
    ;MsgBox(0,"info", $size[0],"")
    WinSetState ($titleold,"",@SW_Restore)
    WinMove ($titleold,"", $size[0]+$RightMoni,$size[1])
    WinSetState ($titleold,"",@SW_SHOWMAXIMIZED)
    Case $size[0] > 1275
    ;MsgBox(0,"info", $size[0],"")
    WinSetState ($titleold,"",@SW_Restore)
    WinMove ($titleold,"",1920,0,640,1024)
    ;WinSetState ($titleold,"",@SW_SHOWMAXIMIZED)
    EndSelect
    Case $state < 46
    Select
    Case $size[0] < 1275
    ;MsgBox(0,"info", $size[0],"")
    WinMove ($titleold,"", $size[0]+$RightMoni,$size[1])
    WinSetState ($titleold,"",@SW_ENABLE)
    Case $size[0] >= 1275
    ;MsgBox(0,"info", $size[0],"")
    WinMove ($titleold,"",1920,0,640,1024)
    WinSetState ($titleold,"",@SW_ENABLE)
    EndSelect

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

    EndSelect
    EndFunc

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

    Func _WINMOVE_LEFT ()
    $size = WinGetPos($titleold)
    $state = WinGetState ($titleold)
    $LeftMoni = 1280
    $RightMoni = 1280
    ;MsgBox(0,"info", $state,"")
    Select
    Case $state == 47
    Select
    Case $size[0] < 1275
    ;MsgBox(0,"info", $size[0],"")
    WinSetState ($titleold,"",@SW_Restore)
    WinMove ($titleold,"",0,0,640,970)
    ;WinSetState ($titleold,"",@SW_SHOWMAXIMIZED)
    Case $size[0] > 1275
    ;MsgBox(0,"info", $size[0],"")
    WinSetState ($titleold,"",@SW_Restore)
    WinMove ($titleold,"", $size[0]-$LeftMoni,$size[1])
    WinSetState ($titleold,"",@SW_SHOWMAXIMIZED)
    EndSelect
    Case $state < 46
    Select
    Case $size[0] < 1275
    ;MsgBox(0,"info", $size[0],"")
    WinMove ($titleold,"",0,0,640,970)
    WinSetState ($titleold,"",@SW_ENABLE)
    Case $size[0] >= 1275
    ;MsgBox(0,"info", $size[0],"")
    WinMove ($titleold,"", $size[0]-$LeftMoni,$size[1])
    WinSetState ($titleold,"",@SW_ENABLE)
    EndSelect

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

    EndSelect
    ;Else
    ;MsgBox (0, "Fensterstatus", "Das Fenster ist nicht maximiert. " & $maxi, "")
    ;EndIf
    EndFunc

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

    Func _WINSPREAD ()
    ;send("!{TAB}")
    $size = WinGetPos($titleold)
    $state = WinGetState ($titleold)
    Select
    Case $size[2] <= 1288
    ;MsgBox (0, "Size",$size[2],"")
    WinSetState ($titleold,"",@SW_Restore)
    WinMove ($title ,"",1, 1, 2559, 970)
    Case $size[2] >= 1288
    ;MsgBox (0, "Size",$size[2],"")
    WinSetState ($titleold,"",@SW_Restore)
    WinMove ($title ,"",1,1,800,600)
    WinSetState ($titleold,"",@SW_MAXIMIZE)
    EndSelect
    EndFunc

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

    Einmal editiert, zuletzt von Peet47 (14. Mai 2010 um 08:15)

  • Mittlerweile läuft es fast so wie ich es will. Es soll aber nicht an die Taskleiste sich anhafeten was es aber tut....


    Kennt da jmd die Lösung für?


    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    ; Opt ("TrayIconHide", 1)
    Opt("WinTitleMatchMode", 2)

    While 1
    Sleep (10)
    $title = WinGetTitle("[active]")
    $state = WinGetState("[active]")
    $size = WinGetPos("[active]")
    If $title<>WinGetTitle("[active]") Or $size<>WinGetPos("[active]") Or $title<>"Toolbar" Then
    GUIDelete()
    Sleep (10)
    $titleold = WinGetTitle("[active]")
    $state = WinGetState("[active]")
    $sizeold = WinGetPos("[active]")
    GUICreate("Toolbar", 60, 20,$size[0]+$size[2]-120,$size[1]+1,$WS_POPUP,BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST))
    $Button1 = GUICtrlCreateIcon("links.ico", "links",45,1,16,16)
    $Button2 = GUICtrlCreateIcon("rechts.ico", "rechts", 1, 1, 16, 16)
    $button3 = GUICtrlCreateIcon("beide.ico", "beide", 22, 1, 16, 16)
    Sleep(10)
    EndIf
    GUISetState()
    WinActivate($titleold)
    While $title="Toolbar" OR $titleold = WinGetTitle("[active]")
    $title = WinGetTitle("[active]")
    $size = WinGetPos("[active]")
    Sleep (10)
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1 ;hier bestimmst du welcher button in diesem fall eben button1
    _WINMOVE_LEFT () ;Hier bestimmst du wie die Funktion heisst die bei einem klick auf dem Button1 aus geführt wird
    ExitLoop
    Case $Button2 ;hier bestimmst du welcher button in diesem fall eben button2
    _WINMOVE_RIGHT ()
    ExitLoop
    Case $Button3
    _WINSPREAD ()
    ExitLoop
    EndSwitch
    If $size[1] <> $sizeold[1] Then
    GUISetState(@SW_HIDE)
    If MouseDown("left") Then
    Sleep (1000)
    EndIf
    Sleep(10)
    ExitLoop
    EndIf
    WEnd
    Wend

    [/autoit]
  • Für alle die, die es Interessiert. Hier die Lösung.

    habs noch hinbekommen..


    Spoiler anzeigen
    [autoit]


    While 1
    Sleep (1000)
    $title = WinGetTitle("[active]")
    $state = WinGetState("[active]")
    $size = WinGetPos("[active]")
    If WinGetHandle("[active]")<>$hTaskbar Then
    If $title<>WinGetTitle("[active]") Or $size<>WinGetPos("[active]") Or $title<>"Toolbar" Then
    ;~ MsgBox(64,"test",WinGetHandle("[ACTIVE]"))
    GUIDelete()
    Sleep (10)
    $titleold = WinGetTitle("[active]")
    $state = WinGetState("[active]")
    $sizeold = WinGetPos("[active]")
    GUICreate("Toolbar", 60, 20,$size[0]+$size[2]-120,$size[1]+1,$WS_POPUP,BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST))
    $Button1 = GUICtrlCreateIcon("links.ico", "links",45,1,16,16)
    $Button2 = GUICtrlCreateIcon("rechts.ico", "rechts", 1, 1, 16, 16)
    $button3 = GUICtrlCreateIcon("beide.ico", "beide", 22, 1, 16, 16)
    Sleep(10)
    EndIf
    EndIf
    GUISetState()
    WinActivate($titleold)
    While $title="Toolbar" OR $titleold = WinGetTitle("[active]")
    $title = WinGetTitle("[active]")
    $size = WinGetPos("[active]")
    Sleep (10)
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1 ;hier bestimmst du welcher button in diesem fall eben button1
    _WINMOVE_LEFT () ;Hier bestimmst du wie die Funktion heisst die bei einem klick auf dem Button1 aus geführt wird
    ExitLoop
    Case $Button2 ;hier bestimmst du welcher button in diesem fall eben button2
    _WINMOVE_RIGHT ()
    ExitLoop
    Case $Button3
    _WINSPREAD ()
    ExitLoop
    EndSwitch
    If $size[1] <> $sizeold[1] Then
    GUISetState(@SW_HIDE)
    If MouseDown("left") Then
    Sleep (750)
    MouseUp("left")
    EndIf
    Sleep(1000)
    ExitLoop
    EndIf
    WEnd
    Wend

    [/autoit]