jxerot wrote:
mm to bad.. doesn't work.. i think there's no way to do it :S:*(
but thanks any way!!

Why so negative?
This is the script I used that worked fine:
Code:
#NoEnv
#Persistent
#SingleInstance, Force
SendMode, Input
SetWorkingDir %A_ScriptDir%
Return
MButton::
{
If ( ( GetTaskbarHandle(hWindow) != 0 ) And ( hWindow != 0 ) )
{
WinClose, ahk_id %hWindow%
}
Else
{
Click Middle Down
KeyWait, MButton
Click Middle Up
}
Return
}
GetTaskbarHandle( ByRef hWindow )
{
hWindow = 0
Return = 0
CoordMode, Mouse, Screen
MouseGetPos, MouseX, MouseY, idWindow, idClass, 2
WinGetClass, cWindow, ahk_id %idWindow%
If cWindow Not In Shell_TrayWnd,UltraMonDeskTaskBar
Return, Return
WinGetClass, cClass, ahk_id %idClass%
If ( cClass != "ToolbarWindow32" )
Return, Return
hParent := DllCall( "GetParent", "UInt", idClass )
WinGetClass, cParent, ahk_id %hParent%
If cParent Not In MSTaskSwWClass,TaskBand
Return, Return
WinGet, pidTaskbar, PID, ahk_id %idClass%
hProcess := DllCall( "OpenProcess", "UInt", (PROCESS_VM_OPERATION:=0x08)+(PROCESS_VM_READ:=0x10)+(PROCESS_VM_WRITE:=0x20), "UInt", 0, "UInt", pidTaskbar)
pButton := DllCall( "VirtualAllocEx", "UInt", hProcess, "UInt", 0, "UInt", 20, "UInt", (MEM_COMMIT:=0x1000), "UInt", (PAGE_READWRITE:=0x4) )
VarSetCapacity( Point, 8, 0 )
NumPut( MouseX, Point, 0, "UInt" )
NumPut( MouseY, Point, 4, "UInt" )
DllCall( "ScreenToClient", "UInt", idClass, "UInt", &Point )
DllCall( "WriteProcessMemory", "UInt", hProcess, "UInt", pButton+0, "UInt", &Point, "UInt", 8, "UInt", 0 )
SendMessage, (TB_HITTEST:=0x445), 0, pButton,, ahk_id %idClass%
nButton := ErrorLevel
If nButton > 0x7FFFFFFF
nButton := -(~nButton)-1
If ( nButton > -1 )
{
SendMessage, (TB_GETBUTTON:=0x417), nButton, pButton,, ahk_id %idClass%
VarSetCapacity(Button, 20)
DllCall( "ReadProcessMemory", "UInt", hProcess, "UInt", pButton, "UInt", &Button, "UInt", 20, "UInt", 0 )
If ( cWindow = "Shell_TrayWnd" )
{
DllCall( "ReadProcessMemory", "UInt", hProcess, "UInt", NumGet( Button, 12, "UInt" ), "UInt*", hWindow, "UInt", 4, "UInt", 0 )
}
Else
{
hWindow := NumGet( Button, 12, "UInt" )
}
Return := nButton+1
}
DllCall( "VirtualFreeEx", "UInt", hProcess, "UInt", pButton, "UInt", 0, "UInt", (MEM_RELEASE:=0x8000) )
DllCall( "CloseHandle", "UInt", hProcess )
Return, Return
}
If the above script doesnt work for you then please run this next script
And tell me what the message box says:
Code:
#NoEnv
#Persistent
#SingleInstance, Force
SendMode, Input
SetWorkingDir %A_ScriptDir%
Return
MButton::
{
Return := GetTaskbarHandle(hWindow)
MsgBox, %Return%
Return
}
GetTaskbarHandle( ByRef hWindow )
{
hWindow = 0
Return = 0
CoordMode, Mouse, Screen
MouseGetPos, MouseX, MouseY, idWindow, idClass, 2
WinGetClass, cWindow, ahk_id %idWindow%
If cWindow Not In Shell_TrayWnd,UltraMonDeskTaskBar
Return, "hWindow = |" . hWindow . "| cWindow = |" . cWindow . "|"
WinGetClass, cClass, ahk_id %idClass%
If ( cClass != "ToolbarWindow32" )
Return, "hWindow = |" . hWindow . "| cWindow = |" . cWindow . "| cClass = |" . cClass . "|"
hParent := DllCall( "GetParent", "UInt", idClass )
WinGetClass, cParent, ahk_id %hParent%
If cParent Not In MSTaskSwWClass,TaskBand
Return, "hWindow = |" . hWindow . "| cWindow = |" . cWindow . "| cClass = |" . cClass . "| cParent = |" . cParent . "|"
WinGet, pidTaskbar, PID, ahk_id %idClass%
hProcess := DllCall( "OpenProcess", "UInt", (PROCESS_VM_OPERATION:=0x08)+(PROCESS_VM_READ:=0x10)+(PROCESS_VM_WRITE:=0x20), "UInt", 0, "UInt", pidTaskbar)
pButton := DllCall( "VirtualAllocEx", "UInt", hProcess, "UInt", 0, "UInt", 20, "UInt", (MEM_COMMIT:=0x1000), "UInt", (PAGE_READWRITE:=0x4) )
VarSetCapacity( Point, 8, 0 )
NumPut( MouseX, Point, 0, "UInt" )
NumPut( MouseY, Point, 4, "UInt" )
DllCall( "ScreenToClient", "UInt", idClass, "UInt", &Point )
DllCall( "WriteProcessMemory", "UInt", hProcess, "UInt", pButton+0, "UInt", &Point, "UInt", 8, "UInt", 0 )
SendMessage, (TB_HITTEST:=0x445), 0, pButton,, ahk_id %idClass%
nButton := ErrorLevel
If nButton > 0x7FFFFFFF
nButton := -(~nButton)-1
If ( nButton > -1 )
{
SendMessage, (TB_GETBUTTON:=0x417), nButton, pButton,, ahk_id %idClass%
VarSetCapacity(Button, 20)
DllCall( "ReadProcessMemory", "UInt", hProcess, "UInt", pButton, "UInt", &Button, "UInt", 20, "UInt", 0 )
If ( cWindow = "Shell_TrayWnd" )
{
DllCall( "ReadProcessMemory", "UInt", hProcess, "UInt", NumGet( Button, 12, "UInt" ), "UInt*", hWindow, "UInt", 4, "UInt", 0 )
}
Else
{
hWindow := NumGet( Button, 12, "UInt" )
}
Return := nButton+1
}
DllCall( "VirtualFreeEx", "UInt", hProcess, "UInt", pButton, "UInt", 0, "UInt", (MEM_RELEASE:=0x8000) )
DllCall( "CloseHandle", "UInt", hProcess )
Return, "hWindow = |" . hWindow . "| cWindow = |" . cWindow . "| cClass = |" . cClass . "| cParent = |" . cParent . "| nButton = |" . nButton . "|"
}