Answers:
与他人所说的相反,这是一个免费的,有效的解决方案,该方案可以最大化鼠标下方的窗口。
(这些钱归功于编写了这些惊人的“自动”功能的人-我只是写了一些使用它们的功能。)
下载autoit并安装(免费软件):
http://www.autoitscript.com/site/autoit/
创建一个.au3文件。
将此粘贴到里面:
#include <misc.au3>
#include <Array.au3>
HotKeySet('{ESC}', '_Exit')
Global $WinText, $OldMouse[2], $NewMouse[2], $Windows, $x, $MyWin, $MyCoords
$NewMouse = MouseGetPos()
$title = _GetWin()
WinSetState($MyWin,"",@SW_RESTORE)
WinMove($MyWin,"",0,0,3840,1165)
Func _GetWin()
Local $Coords
ToolTip("")
$Mouse = MouseGetPos()
$OldMouse = $Mouse
$Windows = _WinList()
;_ArrayDisplay($Windows, "")
For $x = 1 To UBound($Windows)-1
$Coords = WinGetPos($Windows[$x][0], "")
If $Coords = -4 Then ExitLoop
If IsArray($Coords) Then
If $Mouse[0] >= $Coords[0] And $Mouse[0] <= ($Coords[0]+$Coords[2]) And $Mouse[1] >= $Coords[1] And $Mouse[1] <= ($Coords[1]+$Coords[3]) Then ExitLoop
EndIf
Next
If $x = UBound($Windows) Then $x -= 1
$MyWin = $Windows[$x][0]
$Control = _MouseGetCtrlInfo()
$Return = $Windows[$x][0] & @CRLF & $Control
Return $Return
EndFunc
Func _WinList()
Local $WinListArray[1][2]
$var = WinList()
For $i = 1 to $var[0][0]
If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
Redim $WinListArray[UBound($WinListArray) + 1][2]
$WinListArray[UBound($WinListArray)-1][0] = $var[$i][0]
$WinListArray[UBound($WinListArray)-1][1] = $var[$i][1]
EndIf
Next
Return $WinListArray
EndFunc
Func IsVisible($handle)
If BitAnd( WinGetState($handle), 2 ) Then
Return 1
Else
Return 0
EndIf
EndFunc
Func _Exit()
Exit
EndFunc
Func _MouseGetCtrlInfo() ; get ID, Classe and Text of a control
Global $hWin = WinGetHandle($MyWin)
Global $sClassList = WinGetClassList($hWin)
Local $sSplitClass = StringSplit(StringTrimRight($sClassList, 1), @LF)
Local $aMPos = MouseGetPos()
;_ArrayDisplay($sSplitClass, "")
$MyCoords = ClientToScreen($hWin)
For $iCount = UBound($sSplitClass) - 1 To 1 Step - 1
Local $nCount = 0
If $sSplitClass[$iCount] = "WorkerW" Then ContinueLoop
While 1
$nCount += 1
$aCPos = ControlGetPos($hWin, '', $sSplitClass[$iCount] & $nCount)
If @error Then ExitLoop
$hCtrlWnd = ControlGetHandle ($hWin, "", $sSplitClass[$iCount] & $nCount)
If IsArray($aCPos) Then
If $aMPos[0] >= ($MyCoords[0]+$aCPos[0]) And $aMPos[0] <= ($MyCoords[0]+$aCPos[0] + $aCPos[2]) _
And $aMPos[1] >= ($MyCoords[1]+$aCPos[1]) And $aMPos[1] <= ($MyCoords[1]+$aCPos[1] + $aCPos[3]) Then
$aReturn = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $hCtrlWnd)
If @error Then Return "Err"
$Text = ControlGetText($hWin, '', $sSplitClass[$iCount] & $nCount)
If StringInStr($Text, @LF) Then $Text = "demasiado largo"
If IsArray($aReturn) Then Return 'ControlID: ' & $aReturn[0] & @CRLF & 'ClassNameNN: ' & $sSplitClass[$iCount] & $nCount & @CRLF & "Text: " & $Text
EndIf
EndIf
WEnd
Next
;_ArrayDisplay($sSplitClass, "")
Return "No Ctrl"
EndFunc
Func ClientToScreen($hWnd) ; get client area of a win relative to the screan
Local $Point, $aRes[2]
Local $cX, $cY
$Point = DllStructCreate("int;int")
DllStructSetData($Point, 1, $cX)
DllStructSetData($Point, 1, $cY)
DllCall("User32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($Point))
$aRes[0] = DllStructGetData($Point, 1)
$aRes[1] = DllStructGetData($Point, 2)
Return $aRes
EndFunc
然后换行
WinMove($ MyWin,“”,0,0,3840,1165)
符合您的喜好。
然后,您可以为此文件创建Windows快捷方式,右键单击它-> properties,然后分配快捷方式(例如CTRL + ALT + UP)。
您很可能会发现您将需要重复该过程并创建第二个文件以将窗口还原为小尺寸。
希望这可以帮助
Jeff Axelrod具有使用AutoHotKey的出色解决方案。
他映射了Shift + Windows + Up
组合以最大化所有显示的窗口,这与Windows 7的Windows + Up
热键互补,后者在一个监视器中最大化了所选窗口。
这是他的代码(感谢Jeff!):
;Shift + Windows + Up (maximize a window across all displays) https://stackoverflow.com/a/9830200/470749
+#Up::
WinGetActiveTitle, Title
WinRestore, %Title%
SysGet, X1, 76
SysGet, Y1, 77
SysGet, Width, 78
SysGet, Height, 79
WinMove, %Title%,, X1, Y1, Width, Height
return
我使用一个免费的工具VirtualScreenMaximizer来做到这一点:
http://virtualscreenmax.codeplex.com/releases/view/20213
您可以自定义用于最大化和还原的快捷方式,并且在最大化时它将扩展任务栏上的窗口。
在Windows 7上,我可以拖动窗口,使其覆盖两个屏幕。如果右键单击桌面并选择“屏幕分辨率”,则必须在“多个显示器”下选择“扩展这些显示器”。如果再次关闭窗口,它应该记住大小和位置。
如果有人仍然尝试使用autoit来执行此操作,则可以使用以下代码来执行此操作:
HotKeySet("^+{UP}", "Resize_Window") ; CTRL+SHIFT+UP
While 1
Sleep(1000)
WEnd
Func Resize_Window()
WinSetState("[ACTIVE]","",@SW_RESTORE)
WinMove("[ACTIVE]","",0,0,_WinAPI_GetSystemMetrics($SM_CXVIRTUALSCREEN),_WinAPI_GetSystemMetrics($SM_CYVIRTUALSCREEN))
EndFunc
右键单击窗口的工具栏,选择“还原”,然后在两个屏幕上调整其大小。