在 Windows 中将窗口最大化到双显示器?

Cra*_*ack 57 windows multiple-monitors

我有双显示器,我想跨越当前窗口,使其在两台显示器上都显示为一个巨大的窗口。有谁知道如何在 Windows 中本地执行此操作?

nik*_*kos 18

与其他人所说的相反,这里有一个免费的、有效的解决方案,可以最大化鼠标下方的窗口。

(归功于编写这些惊人的“自动”功能的人 - 我只是写了使用它们的部分。)

下载 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
Run Code Online (Sandbox Code Playgroud)

然后换行

WinMove($MyWin,"",0,0,3840,1165)

到你喜欢的价值观。

然后你可以为这个文件创建一个windows快捷方式,右键单击它->属性,然后指定一个快捷方式(例如CTRL+ALT+UP)。

您很可能会发现您需要重复该过程并创建第二个文件以将窗口恢复为小尺寸。

希望这可以帮助


Rya*_*yan 16

Jeff Axelrod 有一个很好的解决方案,它使用AutoHotKey

他映射ShiftWindows?组合以在所有显示器上最大化一个窗口,这与 Windows 7 的Windows?热键相得益彰,该热键在一个显示器中最大化选定的窗口。

这是他的代码(感谢杰夫!):

;Shift + Windows + Up (maximize a window across all displays) /sf/answers/688114031/
+#Up::
    WinGetActiveTitle, Title
    WinRestore, %Title%
   SysGet, X1, 76
   SysGet, Y1, 77
   SysGet, Width, 78
   SysGet, Height, 79
   WinMove, %Title%,, X1, Y1, Width, Height
return
Run Code Online (Sandbox Code Playgroud)

  • 我从 WinMove 行的高度中减去 40,以便仍然能够看到任务栏和开始菜单按钮 (2认同)

Max*_*Max 11

使用双显示器工具:这是一组免费工具,可以管理多个屏幕设置。

交换屏幕工具中,您可以为“超大活动窗口”分配一个热键,以便您可以将其最大化以占据所有屏幕。

  • 来自 Ultramon 的具有理智默认值(全部禁用)的优秀程序,完全符合我的要求。提示:“超大活动窗口”的热键就像一个开关。再次点击它会恢复窗口。 (2认同)

小智 9

我找到了一种无需任何软件或代码即可做到这一点的方法。它不是自动的或完美的,但很简单并且运行良好。

  1. Windows + 向左或向右箭头键可将窗口对齐到两个显示器最远边缘的半个显示器
  2. 抓住窗口的边缘并将其拖过两个显示器到远端


CGA*_*CGA 0

在我的 Windows 7 上,我可以拖动窗口,使其覆盖两个屏幕。如果右键单击桌面并选择“屏幕分辨率”,则必须在“多个显示器”下选择“扩展这些显示器”。如果您再次关闭窗口,它应该记住大小和位置。