本帖最后由 半芯蕃茄 于 2011-12-14 21:01 编辑 #NoTrayIcon
#Include <GuiToolBar.au3>
_SysTray_ClickItem("酷狗", "right", 1)
;====================================================================================
;Autor(s): R.Gilman (a.k.a rasim); Siao (Thanks for idea )
;====================================================================================
Func _SysTray_ClickItem($iTitle, $iButton = "left", $iClick = 1)
Local $hToolbar, $iButCount, $aRect, $i
If Not $iTitle Then
MsgBox(16, "Error", "Please indicate title")
Return 0
EndIf
$hToolbar = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
If @error Then
MsgBox(16, "Error", "System tray not found")
Return 0
EndIf
$iButCount = _GUICtrlToolbar_ButtonCount($hToolbar)
If $iButCount = 0 Then
MsgBox(16, "Error", "Not found item in system tray")
Return
EndIf
For $i = 0 To $iButCount - 1
$cID = _GUICtrlToolbar_IndexToCommand($hToolBar, $i)
If StringInStr(_GUICtrlToolbar_GetButtonText($hToolBar, $i), $iTitle) Then
$aRect = _GUICtrlToolbar_GetButtonRect($hToolBar, $i)
ControlClick("[Class:Shell_TrayWnd]", "", "ToolbarWindow321", $iButton, $iClick, $aRect[0], 5)
$aRect = 0
Return 1
EndIf
Next
MsgBox(48, "Fail", "Required item not found")
EndFunc
以上代码是右键点击酷狗的托盘图标,但是很奇怪的是连托盘空白处的右键也弹了出来。求解决方法,不想弹出如图弹出的:
|