黑色de郁金香 发表于 2008-6-29 18:40:49

托盘图标问题

情况:当我用procssclose结束一个程序的时候,该程序在任务栏右边的托盘图标还会存在,必须用鼠标掠过该图标它才会自动消失,我想通过编程的方式在结束程序的时候把他的托盘图标也一口气干掉。
我试着把任务栏自动隐藏后再改为不自动隐藏,结果没有变化,请高人指导一二,在下不胜感激!
先谢谢了!

sanhen 发表于 2008-6-29 18:58:45

搜索论坛。。。

黑色de郁金香 发表于 2008-6-29 19:01:14

搜索了,正在试验中,目前试验结果不容乐观...

sanhen 发表于 2008-6-29 19:53:25

还有一种比较保险实用的方法,用API的函数来刷新托盘的,只是指针问题,暂时未解决。

黑色de郁金香 发表于 2008-6-29 21:20:56

多谢居士指点!

hotme 发表于 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
      While $y < $posWin + $posWin
            Local $x = $posWin
            While $x < $posWin + $posWin
                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, "int", $posStart)
      If $hControl <> "" And ControlCommand($hWnd, "", $hControl, "IsVisible") Then
            ControlClick($hWnd, "", $hControl)
      EndIf
    Until 1
    Opt("WinTitleMatchMode", $oldMatchMode)
    Opt("WinSearchChildren", $oldChildMode)
    SetError($error)
EndFunc

ruiban 发表于 2009-4-10 17:10:51

多谢

多谢................

crystony 发表于 2009-4-11 23:41:04

学习了,,虽然还不是很懂

wotlitn 发表于 2009-5-22 10:58:49

很好,这方法挺不错的.

316428696 发表于 2009-10-24 22:10:55

是啊,好像还是老脚本语言1

jevonleen 发表于 2010-1-24 01:36:24

留名备用,谢谢
页: [1]
查看完整版本: 托盘图标问题