Hi @all
Ich hab mal ein kleines Tool geschrieben mit welchem mann wenn es angeschaltet ist ein aktives fenster per Maus bewegung an den oberen Rand Maximieren kann.
Es wird natürlich erweitert und das design auf jeden fall überarbeitet weil das mit an und aus gefällt mir nicht, daher würde ich mich über eure vorschläge freuen.
Die Button namen .. kommen dadurch her , weil ich die gui mit dem Koda von Scite erstellt habe.
Ich hoffe das Tool gefällt euch.
Version 1.5
Author: simon
Uppdate:
- 1.1 :Jetzt ist das An und Aus Schalten auch per Hotkey Möglich (Per F1 [an] und F2 [aus]), diese ist aber auch per Häckchen abzustellen.
- 1.2 Rahmen bei maximieren(wenn man die maus wegzieht wird nciht maximiert), Checckbox wird gespeichert,Beenden per F3
- 1.5 Neue Funktion zum maximieren von links bis zur mitte!
Code:
Spoiler anzeigen
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=icon.ico
#AutoIt3Wrapper_Res_Comment=Maximizer für Windows
#AutoIt3Wrapper_Res_Description=Maximizer für Windows
#AutoIt3Wrapper_Res_Fileversion=1.2.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Simon (http://www.autoit.de)
#AutoIt3Wrapper_Res_Language=1031
#AutoIt3Wrapper_Tidy_Stop_OnError=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;(C) Simon (http://www.autoit.de)
; Lizenz: Verwendung ist kostenlos aber es darf nichts verändert oder umbenannt werden und auch nirgendwo hochgeladen werden
;support unter [email='support@simon-webstation.de'][/email]
;Version: 1.5
Global $cfg_file = @ScriptDir & "\config.data"
Global $max_state = 0
Global $max_middle_state = 0
; 0 = aus
; 1 = ein
$check_read = FileReadLine(@ScriptDir & "\config.data", 1)
If $check_read = "" Then
$check_read = $GUI_CHECKED
ElseIf $check_read = 1 Then
$check_read = $GUI_CHECKED
ElseIf $check_read = 4 Then
$check_read = $GUI_UNCHECKED
EndIf
If $check_read = $GUI_CHECKED Then
HotKeySet("{F1}", "_hotkey_an")
HotKeySet("{F2}", "_hotkey_aus")
EndIf
HotKeySet("{F3}", "_exit")
[/autoit] [autoit][/autoit] [autoit]#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Window Maximizer by simon", 306, 325, -1, -1)
$menu = GUICtrlCreateMenu("?")
$menuitem1 = GUICtrlCreateMenuItem("Info", $menu)
$Label1 = GUICtrlCreateLabel("Hier kannst du den Window Maximizer ein oder Ausschalten:", 8, 8, 290, 17)
$Button1 = GUICtrlCreateButton("An", 8, 32, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Aus", 88, 32, 75, 25, $WS_GROUP)
$Label2 = GUICtrlCreateLabel("", 168, 32, 28, 25)
GUICtrlSetBkColor(-1, 0xFF0000)
$Label3 = GUICtrlCreateLabel("Erklärung:", 8, 64, 52, 17)
$Label4 = GUICtrlCreateLabel("Wenn du mit der Maus an den Oberen Bildschirmrand kommst,", 8, 88, 295, 17)
$Label5 = GUICtrlCreateLabel("dann Maximiert sich das Aktive Fenster.", 8, 112, 191, 17)
$Label6 = GUICtrlCreateLabel("(C) simon(www.autoit,de", 8, 136, 124, 17)
$Checkbox1 = GUICtrlCreateCheckbox("An und Aus per Hotkey", 8, 160, 161, 17)
GUICtrlSetState(-1, $check_read)
$Button3 = GUICtrlCreateButton("An", 10, 206, 75, 25, $WS_GROUP)
$Button4 = GUICtrlCreateButton("Aus", 91, 206, 75, 25, $WS_GROUP)
$Label7 = GUICtrlCreateLabel("", 179, 206, 28, 25)
GUICtrlSetBkColor(-1, 0xFF0000)
$Label8 = GUICtrlCreateLabel("Hier kannst du den Maximizer der Linken Seite einstellen:", 8, 184, 273, 17)
$Label9 = GUICtrlCreateLabel("Erklärung:", 8, 232, 52, 17)
$Label10 = GUICtrlCreateLabel("Wenn du mit der Maus an den Linken Bildschrmrand kommst", 8, 256, 290, 17)
$Label11 = GUICtrlCreateLabel("Maximiert sich das Aktive Fenster bis zur mitte des Bildschrims", 8, 280, 294, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
If FileExists($cfg_file) Then
FileDelete($cfg_file)
EndIf
$state_read_for_File = GUICtrlRead($Checkbox1)
FileWriteLine(@ScriptDir & "\config.data", $state_read_for_File)
Exit
Case $Button1
GUICtrlSetBkColor($Label2, 0x00FF00)
$max_state = 1
Case $Button2
GUICtrlSetBkColor($Label2, 0xFF0000)
$max_state = 0
Case $Button3
GUICtrlSetBkColor($Label7, 0x00FF00)
$max_middle_state = 1
Case $Button4
GUICtrlSetBkColor($Label7, 0xFF0000)
$max_middle_state = 0
Case $menuitem1
MsgBox(0, "", "")
EndSwitch
If $max_state = 1 Then
_maximize()
EndIf
If $max_middle_state = 1 Then
_max_middle()
EndIf
If GUICtrlRead($Checkbox1) = $GUI_UNCHECKED Then
HotKeySet("{F1}")
HotKeySet("{F2}")
ElseIf GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
HotKeySet("{F1}", "_hotkey_an")
HotKeySet("{F2}", "_hotkey_aus")
EndIf
WEnd
Func _maximize()
$pos = MouseGetPos()
If $pos[1] = 0 Or $pos[1] = 1 Or $pos[1] = 2 Then
$window_active = WinGetTitle("[ACTIVE]", "")
$state = WinGetState($window_active)
_rahmen($window_active, 1)
Sleep(400)
EndIf
EndFunc ;==>_maximize
Func _max_middle()
$pos1 = MouseGetPos()
If $pos1[0] = 0 Or $pos1[0] = 1 Or $pos1[0] = 2 Then
$window_active = WinGetTitle("[ACTIVE]", "")
$state = WinGetState($window_active)
_rahmen($window_active, 2)
Sleep(400)
EndIf
EndFunc ;==>_max_middle
Func _hotkey_an()
$max_state = 1
GUICtrlSetBkColor($Label2, 0x00FF00)
EndFunc ;==>_hotkey_an
Func _hotkey_aus()
$max_state = 0
GUICtrlSetBkColor($Label2, 0xFF0000)
EndFunc ;==>_hotkey_aus
Func _rahmen($active, $kind)
If $kind = 1 Then
$1 = GUICreate("", 2, @DesktopHeight - 60, 10, 10, $WS_POPUP, $WS_EX_TOOLWINDOW)
GUISetBkColor(0xFF0000)
GUISetState()
$2 = GUICreate("", @DesktopWidth - 30, 2, 10, 10, $WS_POPUP, $WS_EX_TOOLWINDOW)
GUISetBkColor(0xFF0000)
GUISetState(@SW_SHOW)
$3 = GUICreate("", @DesktopWidth - 20, 2, 10, @DesktopHeight - 50, $WS_POPUP, $WS_EX_TOOLWINDOW)
GUISetBkColor(0xFF0000)
GUISetState(@SW_SHOW)
$4 = GUICreate("", 2, @DesktopHeight - 60, @DesktopWidth - 10, 10, $WS_POPUP, $WS_EX_TOOLWINDOW)
GUISetBkColor(0xFF0000)
GUISetState(@SW_SHOW)
$mouse = MouseGetPos()
Sleep(500)
If $mouse[1] = Not 0 Then
GUIDelete($1)
GUIDelete($2)
GUIDelete($3)
GUIDelete($4)
Else
WinActivate($active)
WinSetState($active, "", @SW_MAXIMIZE)
GUIDelete($1)
GUIDelete($2)
GUIDelete($3)
GUIDelete($4)
EndIf
ElseIf $kind = 2 Then
$1 = GUICreate("", 2, @DesktopHeight - 60, 10, 10, $WS_POPUP, $WS_EX_TOOLWINDOW)
GUISetBkColor(0xFF0000)
GUISetState()
$2 = GUICreate("", (@DesktopWidth/2) - 30, 2, 10, 10, $WS_POPUP, $WS_EX_TOOLWINDOW)
GUISetBkColor(0xFF0000)
GUISetState(@SW_SHOW)
$3 = GUICreate("", (@DesktopWidth/2) - 20, 2, 10, @DesktopHeight - 50, $WS_POPUP, $WS_EX_TOOLWINDOW)
GUISetBkColor(0xFF0000)
GUISetState(@SW_SHOW)
$4 = GUICreate("", 2, @DesktopHeight - 60, (@DesktopWidth/2) - 10, 10, $WS_POPUP, $WS_EX_TOOLWINDOW)
GUISetBkColor(0xFF0000)
GUISetState(@SW_SHOW)
$mouse1 = MouseGetPos()
Sleep(600)
If $mouse1[0] = Not 0 Then
GUIDelete($1)
GUIDelete($2)
GUIDelete($3)
GUIDelete($4)
Else
WinActivate($active)
WinMove($active,"",0,0,@DesktopWidth /2,@DesktopHeight - 60)
GUIDelete($1)
GUIDelete($2)
GUIDelete($3)
GUIDelete($4)
EndIf
EndIf
EndFunc ;==>_rahmen
Func _exit()
Exit
EndFunc ;==>_exit
Bekannte Bugs:
Auch wenn die Maus weg ist wird maximiert, wer eine lösung hat bitte posten!
gruß Simon