我正在尝试获取 Seamless windows使用 TightVNC Viewer 实现效果。
基本上我将客户端可见区域设置为应用程序
"C:\Program Files\TightVNC\tvnserver.exe" -controlapp -shareapp <app PID>
然后我使用以下 AutoHotkey 脚本来破解 TightVNC Viewer 窗口(我在其中隐藏工具栏):
^!h::
IfWinExist, antonio - TightVNC Viewer
{
WinSet, Style, ^0xC00000 ; title bar, without you can move only with win-key
WinSet, Style, ^0x800000 ; thin-line border
WinSet, Style, ^0x400000 ; dialog frame
WinSet, Style, ^0x40000 ; sizing border, without you cannot resize
WinSet, Style, ^0x200000 ; vertical scroll bar
WinSet, Style, ^0x100000 ; horizont scroll bar
}
return
; http://www.autohotkey.com/docs/misc/Styles.htm
脚本切换边框和其他窗口元素。
我仍在处理样式,但主要问题是滚动条不会消失。
我怎样才能摆脱它们?
旁注
在 VNC 中本地共享窗口的一个有趣的副作用(即使用环回连接)是,您可以在 Windows 中获得某种 X Server,这对多显示器系统很有吸引力。
最佳答案
我找到了滚动条的“半通用”解决方案。它们不是窗口的属性,而是某些编辑子控件的属性。通过 Window Spy 获取控件名称,您可以从某些应用程序中删除栏,方法是:
Control, Style, -0x100000, <control name>, <app window name>
Control, Style, -0x200000, <control name>, <app window name>
例如,它适用于记事本,其中 <control name>
是 Edit1
。
不幸的是,TightVNC 使用非标准 Window 类 TvnWindowClass1
,我无法影响它的滚动条。
无论如何,替换服务器选项 -shareapp <app PID>
与 -sharewindow <app window name>
,没有滚动条。
以下是本地工作示例,假设您要共享 calc.exe
,其窗口名称为 Calculator
。
按一次 Ctrl+Alt+h 一次,您将在本地启动共享计算器窗口的客户端-服务器 VNC。再按一次,您将获得无缝效果。再按一次,您将返回标准 View (您可以再次移动、调整大小)。
如果使用 Ctrl+Alt+h 切换窗口样式,TightVNC 工具栏也不会切换,请手动将其打开或关闭从窗口控制菜单或使用 Shift+Ctrl+Alt+t。
如果您想在两个不同的系统中使用该脚本,则必须将其分为两部分,其中服务器命令在服务器端运行,客户端命令在客户端系统上运行。
请注意,对于更一般的用途,正则表达式用于命名目标应用程序窗口。
注意 该脚本对于复制窗口很有用。 窗口镜像在 Linux X Window 中是微不足道的事情(对于显示的服务器性质),而在 Windows 中则需要付费工具。当您拥有多显示器系统或投影仪并且您想要复制的不是整个桌面,而是第二台显示器(投影仪)上的某些特定窗口时,镜像就会变得很有用。
^!h::
SetTitleMatchMode RegEx
IfWinExist, TightVNC Viewer$
{
WinGet, Style, Style
if(Style & 0x800000) {
WinGetPos, X, Y
Sleep, 6000
WinSet, Style, -0xC00000 ; title bar, without you can move only with win-key
WinSet, Style, -0x800000 ; thin-line border
WinSet, Style, -0x400000 ; dialog frame
WinSet, Style, -0x40000 ; sizing border, without you can't resize
Send !+^t ; no toolbar
WinMinimize
Sleep, 500
WinRestore
WinMove, X, Y
} else {
WinSet, Style, +0xC00000 ; title bar, without you can move only with win-key
WinSet, Style, +0x800000 ; thin-line border
WinSet, Style, +0x400000 ; dialog frame
WinSet, Style, +0x40000 ; sizing border, without you can't resize
Send !+^t ; no toolbar
}
}
IfWinNotExist, TightVNC Viewer$
{
Run, calc
Run, "C:\Program Files\TightVNC\tvnserver.exe" -run
Sleep, 1000
Run, "C:\Program Files\TightVNC\tvnserver.exe" -controlapp -sharewindow Calculator
Run, "C:\Program Files\TightVNC\tvnviewer" 127.0.0.1
}
return
关于winapi - TightVNC Viewer 通过 Autohotkey 脚本无缝窗口(或镜像 Windows 应用程序窗口),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25242773/