I found a "semi-general" solution for scrollbars. They are not a property of the window, but of some edit child control. Getting the control name via Window Spy, you can remove the bars from some app, with:
Control, Style, -0x100000, <control name>, <app window name>
Control, Style, -0x200000, <control name>, <app window name>
For example it works for for Notepad, where <control name>
is Edit1
.
Unfortunately TightVNC uses a non standard Window class, TvnWindowClass1
, and I am unable to affect its scrollbars.
Anyway, replacing the server option -shareapp <app PID>
with -sharewindow <app window name>
, there are no-scrollbars.
The following is a local working sample assuming you want to share calc.exe
, whose window name is Calculator
.
Press Ctrl+Alt+h once and you will locally start a client-server VNC sharing the Calculator window. Press again and you get the seamless effect. Press again and you get back to standard view (and you can move, size again).
If toggling window style with Ctrl+Alt+h, TightVNC toolbar doesn't toggle too, set it on or off manually in normal view from the window control menu or with
Shift+Ctrl+Alt+t.
If you want to use the script in two distinct systems, you have to split it in two parts where server commands are run on the server side and client ones on the client system.
Note that, for a more general use, regexp are used in naming the target application window.
Note
The script is useful as is to duplicate a window. Window mirroring is something trivial in Linux X Window (for the server nature of the display), which instead require tools paid money in Windows. Mirroring turns useful when you have a multi-monitor system or a projector and you want to duplicate, not the whole desktop, but only some particular windows on the second monitor (projector).
^!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