 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
brak2718 Guest
|
Posted: Mon Mar 29, 2004 2:06 am Post subject: move a window without having to click in the title bar |
|
|
;; Move the selected window by moving the mouse into the title bar
;; and do a click&hold. Tested under Win2k, sp4. The window at
;; least has to be active (selected) before the move ... I used the
;; "tweak ui" program from Microsoft to enable the "activation follows
;; mouse feature .. so now to move a window I just put the mouse
;; anywhere in the window and hit #Tab.
;;
#Tab::
;;; be certain we have a regular window selected and not the
;;; root program manager
;;;
WinGetTitle, wtitle, A
if wtitle =
{
return
}
if wtitle = Program Manager
{
return
}
BlockInput, On
;;; temporarily set the window title to something unique. yes, I
;;; know this is a hack. (otherwise we might select the wrong one
;;; if multiple windows have the same title).
;;;
t1 = "{*(.q"
WinSetTitle, A, , %t1%
WinGetPos, wx1, wy1, , , A
wx1 += 40
wy1 += 10
WinActivate, Program Manager
MouseMove, %wx1%, %wy1%, 0 ; the mouse is now on the title bar
;;; make sure window is on top and then restore title
;;;
WinActivate, %t1%
WinSetTitle, A, , %wtitle%
MouseClick, left, , , , , D
BlockInput, Off
return |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10463
|
Posted: Mon Mar 29, 2004 8:08 am Post subject: |
|
|
I tried that out, it's pretty nice even without the "activation follows mouse" setting. It's especially good for people who like to keep multiple windows visible simultaneously. You just press Win+tab and then drag the mouse to where the window should go, then click once to "drop" the window.
The following, when added to the top of the hotkey subroutine, might be an improvement since it allows you to press the same hotkey a second time to release the mouse (saves from having to left-click after the move, which some might like):
| Code: | GetKeyState, state, LButton
if state = D ; Left mouse button is already down.
{
MouseClick, left, , , , , U ; Release it.
return
} |
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10463
|
Posted: Mon Mar 29, 2004 9:03 am Post subject: |
|
|
| It looks like a combination of Windows API calls WindowFromPoint() and GetCursorPos() can determine which window is under the mouse. If it would be a significant improvement for you, I can extend one of the existing commands to support this feature. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|