ViciousXUSMC Posted August 31, 2016 Posted August 31, 2016 I use a 3 monitor setup at work and remote into other servers on the regular. For the longest I used only one monitor for RDP and that was terrible because when I do a support session from that RDP session I have no space left to use for documents. I recently enabled the "use all monitors" feature and now the RDP session spans all 3 monitors, ends up that is not much better as I usually have a ticket or other important information on my host computer so I end up having to minimize and restore the RDP session over and over to get the details I want. The real solution for me is going to be a RDP session with 2 monitors and leaving my 3rd untouched. Looks like there is no "real" way to do this. But I did find a work around using AHK. ere is my work around for my 3x1 setup to use 2 monitors with a similar experience: edit the RDP file for the resolution I'm looking for. Turn off multi monitor and turn off smart screen sizing (not really required) screen mode id:i:1 use multimon:i:0 desktopwidth:i:3840 desktopheight:i:1080 smart sizing:i:0 Next I use auto hot key to make the app appear like a full screen, borderless app. Windows+F11 resizes the window to desktop 2 and 3 and removes the border. Win+f12 restores the border for easy move. Just FYI, the RDP client is odd in that it captures all key strokes so I had to use the class name of the window to target it. You cannot have the app active. Just select the desktop or another app and then hit win+F11 or win+F12. Also, make sure the window is not maximized. Here is the ahk script: #f11:: WinSet, Style, -0xCF0000, ahk_class TscShellContainerClass WinMove ahk_class TscShellContainerClass,, 0,0,3840,1080 return #f12:: WinSet, Style, +0xCF0000, ahk_class TscShellContainerClass return So I looked and I know we have WinSetState() and WinMove() but I cant see how to recreate t he Set Style portion, where the window border is removed. I know we have GUI functions for that, but how to do that for a normal window? This is the closest I have found so far I think: Func _API_SetWindowLongPtr($hWnd, $iIndex, $iValue) Local $aResult $aResult = DllCall("User32.dll", "int", "SetWindowLongPtr", "hwnd", $hWnd, "int", $iIndex, "int", $iValue) Return $aResult[0] EndFunc And used these pages for reference: https://msdn.microsoft.com/en-us/library/ms644898.aspx https://msdn.microsoft.com/en-us/library/ms632600.aspx My testing script #RequireAdmin $hWnd = WinGetHandle("Untitled - Notepad", "") _API_SetWindowLongPtr($hWnd, -16, "0x00040000L") Func _API_SetWindowLongPtr($hWnd, $iIndex, $iValue) Local $aResult $aResult = DllCall("User32.dll", "int", "SetWindowLongPtr", "hwnd", $hWnd, "int", $iIndex, "int", $iValue) Return $aResult[0] EndFunc However no luck so far, not sure what I am doing wrong.
Danyfirex Posted August 31, 2016 Posted August 31, 2016 (edited) Hello. AutoIt does not use "L" suffix. #include <WinAPI.au3> #RequireAdmin Global Const $WS_SIZEBOX = 0x00040000 Global Const $GWL_STYLE = -16 Local $hWnd = WinGetHandle("Untitled - Notepad", "") _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $WS_SIZEBOX) Saludos Edited August 31, 2016 by Danyfirex Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
ViciousXUSMC Posted August 31, 2016 Author Posted August 31, 2016 Thanks Dany, so what can I use for WS_OVERLAPPEDWINDOW style? it does not have a value on the MSDN page. I guess just sum up the values of each individual style?
Danyfirex Posted August 31, 2016 Posted August 31, 2016 I don't know what you're trying to achieve but I think is WS_OVERLAPPED. Check Window Styles link you posted above. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
ViciousXUSMC Posted August 31, 2016 Author Posted August 31, 2016 (edited) Well, made progress but still stuck. Seems no matter what style I apply I just lose the title and all the buttons on the window, it becomes static in the background and nothing on the window can be interacted with any longer. Edit: looks like I needed to append it to the current style. This is pretty much working the way I wanted it too. #Include <WinAPI.au3> #Include <WindowsConstants.au3> HotKeySet("{F11}", "Borderless") HotKeySet("{F10}", "Bordered") HotKeySet("{F9}", "Minimize") GLOBAL $hWnd = WinGetHandle("[CLASS:TscShellContainerClass]") GLOBAL $Style = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE) ;_WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $WS_OVERLAPPEDWINDOW) ;_WinAPI_SetWindowLong($hWnd, $GWL_STYLE, BitOr($Style, $WS_OVERLAPPEDWINDOW)) While 1 Sleep(10) WEnd Func Borderless() _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, BitXOR($Style, 0xCF0000)) WinMove($hWnd, "", -1920, 0, (1920*2), 1080) EndFunc Func Bordered() _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $Style) WinMove($hWnd, "", -1920, 0, (1920*2), 1080) EndFunc Func Minimize() WinSetState($hWnd, "", @SW_MINIMIZE) EndFunc Edited August 31, 2016 by ViciousXUSMC
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now