使用Cmd.exe进行Autohotkey全屏显示

时间:2017-01-08 05:09:39

标签: cmd fullscreen autohotkey

使用ahk,我可以在Windows 7上使用什么脚本来全屏cmd? 我已经设法使用Windows 10全屏,但在Windows 7上它看起来像这样。 Fullscreen test

但是你可以看到顶部和左侧有边框,我使用的是以下脚本。

WinGetTitle, currentWindow, A
IfWinExist %currentWindow%
{
    WinSet, Style, ^0xC00000 ; toggle title bar
}
return

我该怎么做才能让它发挥作用?

1 个答案:

答案 0 :(得分:0)

也许你需要删除边框?

试试这个:

/*  YABT+ - Yet Another Borderless-Window Toggle
 *  by Barrow (March 30, 2012)
 *  rewritten by kon (May 16, 2014)
 *  http://www.autohotkey.com/board/topic/78903-yabt-yet-another-borderless-window-toggle/page-2#entry650488
 *  updated by Hastarin (Dec 5, 2014)
 *  updated by WAZAAAAA (Sep 27, 2016)
 *  tested with AutoHotkey v1.1.24.01
*/
WinGetTitle, currentWindow, A
IfWinExist %currentWindow%
{
    Toggle_Window(WinExist(currentWindow))
}

Toggle_Window(Window:="") {
    static A := Init()
    if (!Window)
        MouseGetPos,,, Window
    WinGet, S, Style, % (i := "_" Window) ? "ahk_id " Window :  ; Get window style
    if (S & +0xC00000) {                                        ; If not borderless
        WinGet, IsMaxed, MinMax,  % "ahk_id " Window
    if (A[i, "Maxed"] := IsMaxed = 1 ? true : false)
        WinRestore, % "ahk_id " Window
    WinGetPos, X, Y, W, H, % "ahk_id " Window               ; Store window size/location
    for k, v in ["X", "Y", "W", "H"]
        A[i, v] := %v%
    Loop, % A.MCount {                                      ; Determine which monitor to use
        if (X >= A.Monitor[A_Index].Left
            &&  X <  A.Monitor[A_Index].Right
    &&  Y >= A.Monitor[A_Index].Top
    &&  Y <  A.Monitor[A_Index].Bottom) {
        WinSet, Style, -0xC00000, % "ahk_id " Window    ; Remove borders
        WinSet, Style, -0x40000, % "ahk_id " Window    ; Including the resize border
        WinSet, ExStyle, -0x00000200, % "ahk_id " Window ;Also WS_EX_CLIENTEDGE
        ; The following lines are the x,y,w,h of the maximized window
        ; ie. to offset the window 10 pixels up: A.Monitor[A_Index].Top - 10
        WinMove, % "ahk_id " Window,
        , A.Monitor[A_Index].Left                               ; X position
        , A.Monitor[A_Index].Top                                ; Y position
        , A.Monitor[A_Index].Right - A.Monitor[A_Index].Left    ; Width
        , A.Monitor[A_Index].Bottom - A.Monitor[A_Index].Top    ; Height
        break
    }
}
}
else if (S & -0xC00000) {                                           ; If borderless
    WinSet, Style, +0x40000, % "ahk_id " Window         ; Reapply borders
WinSet, Style, +0xC00000, % "ahk_id " Window
WinSet, ExStyle, +0x00000200, % "ahk_id " Window ;Also WS_EX_CLIENTEDGE
WinMove, % "ahk_id " Window,, A[i].X, A[i].Y, A[i].W, A[i].H    ; Return to original position
if (A[i].Maxed)
    WinMaximize, % "ahk_id " Window
A.Remove(i)
}
}

Init() {
    A := {}
    SysGet, n, MonitorCount
    Loop, % A.MCount := n {
        SysGet, Mon, Monitor, % i := A_Index
        for k, v in ["Left", "Right", "Top", "Bottom"]
            A["Monitor", i, v] := Mon%v%
    }
    return A
}