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

关于系统托盘上面鼠标点击问题

[复制链接]
发表于 2009-9-26 13:50:33 | 显示全部楼层 |阅读模式
我自己写了一个阳光骑士自动改机号的程序,但是好像不是很准确,有的时候可以正常改过来,有的时候,鼠标却不能正常定位到我需要的程序系统托盘图标的准确位置,导致更改不成功,我想请各位大大帮忙看看,有什么地方需要改进的?帮忙指点一下,谢谢了!

代码如下:
#NoTrayIcon
#Include <GuiToolBar.au3>
run(@SystemDir&"\pcpolice\pcpolice.exe")
sleep(1000)
_SysTray_ClickItem("网吧管理系统", "left", 2)
send("{ALT}")
send("{down 2}")
send("{enter}")
Send("12345678901234567890")
send("{ENTER}")
sleep(1000)
_SysTray_ClickItem("网吧管理系统", "right", 1)
send("{down 4}")
send("{enter}")
$text=ControlGetText ( "配置面板", "客户机名称", 1003)
ControlSetText ( "配置面板", "客户机名称", 1003,  @ComputerName)
ControlClick ( "配置面板", "客户机名称", 1 , "left", 1)
Exit

Func _SysTray_ClickItem($iTitle, $iButton = "left", $iClick = 1, $sMove = False, $iSpeed = 1)
    Local $hToolbar, $iButCount, $aRect, $hButton, $cID, $i
   
    $hToolbar = ControlGetHandle("[Class:Shell_TrayWnd]", "", "[Class:ToolbarWindow32;Instance:1]")
    If @error Then
        Return SetError(1, 0, 0)
    EndIf
   
    $iButCount = _GUICtrlToolbar_ButtonCount($hToolbar)
    If $iButCount = 0 Then
        Return SetError(1, 0, 0)
    EndIf
   
    $hButton = ControlGetHandle("[Class:Shell_TrayWnd]", "", "Button2")
    If $hButton <> "" Then ControlClick("[Class:Shell_TrayWnd]", "", "Button2")
   
    For $i = 0 To $iButCount - 1
        $cID = _GUICtrlToolbar_IndexToCommand($hToolBar, $i)
        If StringInStr(_GUICtrlToolbar_GetButtonText($hToolBar, $cID), $iTitle) Then
            _GUICtrlToolbar_ClickButton($hToolbar, $cID, $iButton, $sMove, $iClick, $iSpeed)
            Return 1
        EndIf
    Next
    Return SetError(1, 0, 0)
EndFunc

下面是已经编译好的程序,还有阳光骑士的安装程序。
http://www.dbank.com/download.ac ... 64ca52cfc8414c7d6cd
 楼主| 发表于 2009-9-27 19:21:25 | 显示全部楼层
都刷到后面去了,高手帮忙看一下啦~!谢了。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-22 19:37 , Processed in 0.080714 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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