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
#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)
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
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
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
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
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
Ich hoffe ihr könnt mir helfen.
mfg
Peet