I found this excellent code which prevents the movement of a window. The problem is, it works by, when enabled, use the combinations of Win+f2 to activate, and Win+f3 to deactivate. But I want it to work just like the "Make Window Transparent" and "Windows always on Top +" in a way that, if I press the shortcut, it will activate and disable movement, and if I press again, it will deactivate and enable movement of that window. Is it possible?
Thanks a lot in advance.
Code: Select all
#F2::DisableMove()
#F3::RedrawSysMenu()
DisableMove(hWnd="") {
If hWnd=
hWnd:=WinExist("A")
hSysMenu:=DllCall("GetSystemMenu","Int",hWnd,"Int",FALSE)
DllCall("RemoveMenu","Int",hSysMenu,"UInt",1,"Uint",0x400)
DllCall("DrawMenuBar","Int",hWnd)
Return ""
}
RedrawSysMenu(hWnd="") {
If hWnd=
hWnd:=WinExist("A")
DllCall("GetSystemMenu","Int",hWnd,"Int",TRUE)
DllCall("DrawMenuBar","Int",hWnd)
Return ""
}