找回密码
 加入
搜索
查看: 4486|回复: 10

托盘图标问题

[复制链接]
发表于 2008-6-29 18:40:49 | 显示全部楼层 |阅读模式
情况:当我用procssclose结束一个程序的时候,该程序在任务栏右边的托盘图标还会存在,必须用鼠标掠过该图标它才会自动消失,我想通过编程的方式在结束程序的时候把他的托盘图标也一口气干掉。
我试着把任务栏自动隐藏后再改为不自动隐藏,结果没有变化,请高人指导一二,在下不胜感激!
先谢谢了!
发表于 2008-6-29 18:58:45 | 显示全部楼层
搜索论坛。。。
 楼主| 发表于 2008-6-29 19:01:14 | 显示全部楼层
搜索了,正在试验中,目前试验结果不容乐观...
发表于 2008-6-29 19:53:25 | 显示全部楼层
还有一种比较保险实用的方法,用API的函数来刷新托盘的,只是指针问题,暂时未解决。
 楼主| 发表于 2008-6-29 21:20:56 | 显示全部楼层
多谢居士指点!
发表于 2009-4-3 19:40:59 | 显示全部楼层
_RefreshSystemTray()

Func _RefreshSystemTray($nDelay = 1000)
    Local $oldMatchMode = Opt("WinTitleMatchMode", 4)
    Local $oldChildMode = Opt("WinSearchChildren", 1)
    Local $error = 0
    Do
        Local $hWnd = WinGetHandle("classname=TrayNotifyWnd")
        If @error Then
            $error = 1
            ExitLoop
        EndIf
        Local $hControl = ControlGetHandle($hWnd, "", "Button1")
        
        If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then
            ControlClick($hWnd, "", $hControl)
            Sleep($nDelay)
        EndIf
        Local $posStart = MouseGetPos()
        Local $posWin = WinGetPos($hWnd)   
        Local $y = $posWin[1]
        While $y < $posWin[3] + $posWin[1]
            Local $x = $posWin[0]
            While $x < $posWin[2] + $posWin[0]
                DllCall("user32.dll", "int", "SetCursorPos", "int", $x, "int", $y)
                If @error Then
                    $error = 2
                    ExitLoop 3;
                EndIf
                $x += 8
            WEnd
            $y += 8
        WEnd
        DllCall("user32.dll", "int", "SetCursorPos", "int", $posStart[0], "int", $posStart[1])
        If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then
            ControlClick($hWnd, "", $hControl)
        EndIf
    Until 1
    Opt("WinTitleMatchMode", $oldMatchMode)
    Opt("WinSearchChildren", $oldChildMode)
    SetError($error)
EndFunc
发表于 2009-4-10 17:10:51 | 显示全部楼层

多谢

多谢................
发表于 2009-4-11 23:41:04 | 显示全部楼层
学习了,,虽然还不是很懂
发表于 2009-5-22 10:58:49 | 显示全部楼层
很好,这方法挺不错的.
发表于 2009-10-24 22:10:55 | 显示全部楼层
是啊,好像还是老脚本语言1
发表于 2010-1-24 01:36:24 | 显示全部楼层
留名备用,谢谢
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-29 07:34 , Processed in 0.076491 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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