托盘图标问题
情况:当我用procssclose结束一个程序的时候,该程序在任务栏右边的托盘图标还会存在,必须用鼠标掠过该图标它才会自动消失,我想通过编程的方式在结束程序的时候把他的托盘图标也一口气干掉。我试着把任务栏自动隐藏后再改为不自动隐藏,结果没有变化,请高人指导一二,在下不胜感激!
先谢谢了! 搜索论坛。。。 搜索了,正在试验中,目前试验结果不容乐观... 还有一种比较保险实用的方法,用API的函数来刷新托盘的,只是指针问题,暂时未解决。 多谢居士指点! _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
多谢
多谢................ 学习了,,虽然还不是很懂 很好,这方法挺不错的. 是啊,好像还是老脚本语言1 留名备用,谢谢
页:
[1]