找回密码
 加入
搜索
查看: 2220|回复: 1

[AU3基础] 右下角托盘上图标的右击行为

[复制链接]
发表于 2010-5-27 08:09:32 | 显示全部楼层 |阅读模式
目前在坛子里找到右下角托盘上图标的右击行为解决方法如下:
但有以下问题痛苦中,感谢您万忙中指点一下。无比感谢。
问题1:  若是: left 一般无问题,若是right就会容易在右下解多一下不是这个位置右击的菜单;
问题2:  若这个图标被卷起来了,这段代码是不起作用的。痛苦中。
#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
发表于 2010-5-27 14:31:27 | 显示全部楼层
不行的话 mousemove
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-22 05:35 , Processed in 0.076738 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表