duzhor
V2EX  ›  Windows

windows 窗口如何隐藏标题栏?

  •  
  •   duzhor · Jun 27, 2022 · 5136 views
    This topic created in 1462 days ago, the information mentioned may be changed or developed.

    需求是远程桌面想隐藏掉上方的标题栏,让远程桌面更像是一个普通窗口。

    找到了 2 个相同实现原理的工具,让游戏窗口实现无边框,但是有点点瑕疵,标题栏是隐藏了,但是窗口下方复制显示(不知道怎么表达)

    https://github.com/KasumiL5x/Fullscreenizer

    https://github.com/Zero3K/fullscreenizer

    有没有更完美的工具实现?

    Supplement 1  ·  Jun 27, 2022
    我又优化了一下 ahk 脚本,供参考

    获取 mstsc.exe 进程的窗口位置和大小

    ```
    SetTitleMatchMode 2
    WinGetPos, X, Y, W, H, ahk_exe mstsc.exe
    MsgBox, X,Y: %X%`,%Y%`nWxH:%W%x%H%
    ```

    匹配指定窗口标题,隐藏标题栏并设置窗口大小和位置

    ```
    SetTitleMatchMode 2
    WinSet, Style, -0xC00000, "远程连接 IP"
    WinMove, "远程连接 IP", , 888, 265, 1040, 784
    ```
    8 replies    2022-06-27 19:31:03 +08:00
    tmqhliu
        1
    tmqhliu  
       Jun 27, 2022
    需要调用 Windows API
    基本思路是使用 FindWindow() 查找需要的窗口,再使用 SetWindowLong() 修改窗口样式
    zjj19950716
        2
    zjj19950716  
       Jun 27, 2022   ❤️ 1
    是去掉 - 口 X 这排吗?
    是的话可以试试 AutoHotKey ,可能有些软件不支持,试了下记事本,Adobe pdf 是可以的,计算器,wps 好像不行
    WinSet, Style, -0xC00000, A ; Remove the active window's title bar (WS_CAPTION).
    Les1ie
        3
    Les1ie  
       Jun 27, 2022
    歪楼

    第一次看到 - 口 X 这个表示按钮的方式,我认为楼上的创意非常好,太妙了!
    joshua7v
        4
    joshua7v  
       Jun 27, 2022 via iPhone
    AltSnap 可以一试
    xiaocsl
        5
    xiaocsl  
       Jun 27, 2022
    https://github.com/Codeusa/Borderless-Gaming
    https://store.steampowered.com/app/388080/Borderless_Gaming/

    这一类的,都是修改窗口 WS 和 WS_EX
    https://docs.microsoft.com/en-us/windows/win32/winmsg/window-styles
    https://docs.microsoft.com/en-us/windows/win32/winmsg/extended-window-styles

    AutoHotKey 相关的脚本也都是..图省事直接用现成的,有特殊需求的话,都是最基础的 Win32 开发.类似于"照着文档改下参数"的事.
    duzhor
        6
    duzhor  
    OP
       Jun 27, 2022
    @zjj19950716 试了下你这个修改后直接查找进程然后隐藏掉,效果还不错
    WinSet, Style, -0xC00000, ahk_exe mstsc.exe ; Remove the active window's title bar (WS_CAPTION).
    duzhor
        7
    duzhor  
    OP
       Jun 27, 2022
    @xiaocsl 感谢分享,相信这种工具有更丰富的用途,我用楼上的命令稍作修改已经满足预期效果
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2734 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 05:01 · PVG 13:01 · LAX 22:01 · JFK 01:01
    ♥ Do have faith in what you're doing.