03-03-2010, 02:23 AM -
Hi Yuri,
I also have another autohotkey script that emulates another great feature of the blackbox replacement shell. Right-clicking a window titlebar minimizes the window, middle-clicking a window titlebar closes the window. Since both fetches right-clicks, these two interferes with each other.
This one operates with WM_NCHITTEST to detect titlebar clicks. If I knew how to detect desktop clicks either with WM_NCHITTEST or with any other trick, the two features could be combined.
This is the other script (works fine, you can try that, or I can also give the compiled standalone exe)
I also have another autohotkey script that emulates another great feature of the blackbox replacement shell. Right-clicking a window titlebar minimizes the window, middle-clicking a window titlebar closes the window. Since both fetches right-clicks, these two interferes with each other.
This one operates with WM_NCHITTEST to detect titlebar clicks. If I knew how to detect desktop clicks either with WM_NCHITTEST or with any other trick, the two features could be combined.
This is the other script (works fine, you can try that, or I can also give the compiled standalone exe)
Code:
SetTitleMatchMode, 2
;#IfWinActive, Firefox
~RButton::
{
CoordMode, Mouse, Screen
SetMouseDelay, -1 ; no pause after mouse clicks
SetKeyDelay, -1 ; no pause after keys sent
MouseGetPos, ClickX, ClickY, WindowUnderMouseID
WinActivate, ahk_id %WindowUnderMouseID%
WM_NCHITTEST_Result := IsOverTitleBar( ClickX, ClickY, WindowUnderMouseID )
If ( WM_NCHITTEST_Result = 1 ) ; in titlebar enclosed area - top of window
{
If ClickY > 22
{
;MsgBox, %ClickY% Right-click in titlebar.
Send, {ESC}
;WinMinimize, ahk_class MozillaUIWindowClass
WinMinimize, ahk_id %WindowUnderMouseID%
}
}
}
return
~MButton::
{
CoordMode, Mouse, Screen
SetMouseDelay, -1 ; no pause after mouse clicks
SetKeyDelay, -1 ; no pause after keys sent
MouseGetPos, ClickX, ClickY, WindowUnderMouseID
WinActivate, ahk_id %WindowUnderMouseID%
WM_NCHITTEST_Result := IsOverTitleBar( ClickX, ClickY, WindowUnderMouseID )
If ( WM_NCHITTEST_Result = 1 ) ; in titlebar enclosed area - top of window
{
;MsgBox, Right-click in Firefox's titlebar.
;WinMinimize, ahk_class MozillaUIWindowClass
WinClose, ahk_id %WindowUnderMouseID%
Send, {ESC}
}
}
return
#IfWinActive
; http://www.autohotkey.com/forum/topic22178.html
IsOverTitleBar(x, y, hWnd)
{
SendMessage, 0x84,, (x & 0xFFFF) | (y & 0xFFFF) << 16,, ahk_id %hWnd%
;msgbox, %ErrorLevel%
if ErrorLevel in 2,3,8,9,20,21
return true
else
return false
}
Visit my deviantArt gallery: http://ethsza.deviantart.com