62

I have dual monitors and I want to span my current window so that it appears as one giant window on both monitors. Does anyone know how to do this natively in Windows?

15 Answers15

22

Jeff Axelrod has a great solution that uses AutoHotKey.

He maps the ShiftWindows combination to maximize a window across all displays, which compliments Windows 7's Windows hotkey, which maximizes the selected window in one monitor.

Here is his code (thanks 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
Ryan
  • 2,388
17

In contrast with what others are saying, here is a free, working solution that maximises the window which is under the mouse.

(Credits go to the guy who wrote these amazing 'autoit' functions - I just wrote the bit which uses them.)

Download autoit and install it (free software):

http://www.autoitscript.com/site/autoit/

Create a .au3 file.

Paste this inside:

#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

Then change the line

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

to the values of your liking.

Then you can create a windows shortcut to this file, right click it->properties, and assign a shortcut (e.g. CTRL+ALT+UP).

Most likely you will find that you will need to repeat the procedure and create a second file to restore the window to a small size.

Hope this helps

nikos
  • 179
  • 1
  • 4
12

Use Dual Monitor Tools: it's a set of free tools do manage multiple screens setup.

In the Swap screen tool you can assign a hotkey to the "Supersize active window" so you can maximize it to occupy all the screens.

Max
  • 1,099
11

I found a way to do this without any software or code. It isn't automatic or perfect, but is easy and works well enough.

  1. Windows + left or right arrow key to snap the window to half a monitor on the far edge of the two monitors
  2. Grab the edge of the window and drag it across both monitors to the far side
4

A bit late but if using Intel integrated graphics you can open the Intel graphics control panel, select display menu and from there choose multiple displays and choose "Collage" this will let you choose which monitors you would like to extend across along with some other choices.

Here's a screenshot of it enabled:

Heres a screenshot of it enabled

Brad
  • 41
3

If you have an nVidia video card:

  1. Right-click on the desktop, and click "NVIDIA Control Panel"
  2. At the bottom of the list of tasks, under Workstation, is "Set up Mosaic". Click it.
  3. In the right pane, click the checkbox next to "Enable Mosaic"
  4. Under Displays, put checkmarks next to the monitors you want to combine.
  5. Under Configuration, select what topology you want (side-by-side, vertical..)
  6. At the bottom-right of the screen, click "Apply"

Now, when you click the Maximize button, it'll cover both monitors. Your taskbar will also cover both monitors. If that bugs you, try dragging it to the left of the monitor so it becomes vertical (this works better if you make the icons small and use 'never combine').

2

I use a free utility to do so, VirtualScreenMaximizer:

http://virtualscreenmax.codeplex.com/releases/view/20213

You can customize the shortcuts to use for maximizing and restoring, and it will expand the window over the taskbar when maximizing.

1

Click and drag, otherwise you can use your advanced graphics card to configure the monitors to act as one large screen.

Garrett
  • 751
0

I use this workaround with Sizer (homepage) - its small freeware utility allows you to set predefined windows size by right-click in Window stretch area.

Just create profile set:

  • Width = sum of monitors widths
  • Height = Monitor height - taskbar height (= 40)
  • Move to = Top left.

Then just right click to right-bottom end of the Window and select the profile.

enter image description here

Lluser
  • 905
0

UPDATE: Turns out this is from something called nView Desktop Manager from NVidia. Available for Quadro and NVS products on Windows 7 to 10. "https://www.nvidia.com/en-us/drivers/nview/149_77/nview-win7-win10-x64-149-77-driver/". Original answer below.

While researching this, (to figure out how I did it by accident a few times), I figured out an answer. Hold "shift" key when you click the maximize button if you have Windows 10. For me, it maximizes across all 3 of my monitors, all of which are different sizes, different connections (vga,dvi,dvi to display port adapter), and 1 of them is on a KVM switch. The height is set to the smallest of the 3 monitors so things line up across all. I assume it would work as expected for same size monitors.

Note: I don't know if this is a recent feature or been around a while. Haven't found anything about it online.

stymie2
  • 1
  • 1
0

On Windows 11, unmaximise your window, then while pressing Shift + Windows keys, click to maximise. Hope this helps

0

On my Windows 7 I'm able to drag the window so that it covers both screens. If you right click your desktop and chose "screen resolution", you have to chose "extend these displays" under "multiple displays". If you close the window again it should remember size and position.

CGA
  • 3,829
0

If anyone is still trying to do this using autoit I managed do this using this code:

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
Joel Coehoorn
  • 28,637
-1

Right click on toolbar of windows, select Restore, then resize it on both screens.

-1

i was able to get F11-maximized windows over 3 unified displays using NVidia Mosaic with a Quadro GPU. I was NOT able to do it using autoit / autohotkey / dual monitor tools / virtualscreenmaximizer / intel collage. With these you can get a maximal size window but not a gui-less maximized window.