I want to use AHK to simulate Ctrl + Alt + break.
The below code does nothing. I have also pasted the key history with first using the Num - and then actually pressing the set of trio keys. The AHK key doesn't work while the actual pressing of key works. The codes generated by both appear to be same to me except that Break has d & u with AHK. But that shouldn't matter. I also introduced the delay but that also doesn't work.
SetKeyDelay, 2,2
NumpadSub::
send {LCtrl Down}{LAlt Down}{vk03sc146}{LCtrl Up}{LAlt Up}
return
I also tried with {CtrlBreak} and the below with no success in Win XP remote desktop. send !^{vk03sc146} This code works find in my win 7. However I need to remote in to the Win XP. Help please.
6D 04A d 1.33 Num -
A2 01D i d 0.00 Ctrl
A4 038 i d 0.02 Alt
03 146 i d 0.02 Break
03 146 i u 0.02 Break
A2 01D i u 0.02 Ctrl
A4 038 i u 0.02 Alt
6D 04A u 0.16 Num -
74 03F d 1.00 F5
74 03F u 0.09 F5
74 03F d 2.02 F5
74 03F u 0.13 F5
74 03F d 0.19 F5
74 03F u 0.11 F5
A2 01D d 1.31 Ctrl
A4 038 d 0.00 Alt
03 146 u 0.39 Break
A2 01D u 0.06 Ctrl
A4 038 u 0.03 Alt
74 03F d 3.08 F5
It is possible to capture the CapsLock
key from AHK even if it was started before RDP, it is the ONLY key that RDP passes on to other keyboard hooks.
This can be done on the local machine. When you do it on the local machine, and NOT on the remote machine, you can use AHK to obtain the window id of MSTSC, and pass a restore command to the window (no sending of keys, which is terribly unreliable)
;Get MSTSC window (this may have to be "ahk_class TSSHELLWND" for systems other than Win7)
If WinActive("ahk_class TscShellContainerClass") {
WinGet, active_id, ID, A
PostMessage, 0x112, 0xF120,,, ahk_id %active_id% ; 0x112 = WM_SYSCOMMAND, 0xF120 = SC_RESTORE
}
The above command will break MSTSC from fullscreen.
A full example of this can be seen here (http://code.ecomerc.com/Articles/RotateCube/), where it is used to break MSTSC from fullscreen and rotate the cube function of Dexpot (a 3d window manager)
All credits to Peter's answer above, which is the only working solution so far after a hour search. I slightly modified it to make it only slightly more complete.
This AHK script allows using alt + capslock
to exit full screen mode and then when the remote desktop window is selected, press the alt + capslock
again to restore full screen.
Start the AHK script on the host machine.
;Get MSTSC window (this may have to be "ahk_class TSSHELLWND" for systems other than Win7)
!Capslock::
T := !T
If WinActive("ahk_class TscShellContainerClass") {
WinGet, active_id, ID, A
if T
PostMessage, 0x112, 0xF120,,, ahk_id %active_id% ; 0x112 = WM_SYSCOMMAND, 0xF120 = SC_RESTORE
else
PostMessage, 0x112, 0xF030,,, ahk_id %active_id% ; 0x112 = WM_SYSCOMMAND, 0xF030 = SC_MAXIMIZE
}
return
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With