anixon Posted June 20, 2008 Share Posted June 20, 2008 This code closes Skype if it is running: $PID = ProcessExists("Skype.exe") If $PID Then ProcessClose($PID) EndIf However the Tray Icon associated with the Skype.exe remains visible until you roll the mouse pointer over it and which time it disappears. With the Icon visible and no process this leaves the user with the impression that Skype is still running. How do you clean up the Tray Icon after you have closed the process using ProcessClose()? Ant.. Link to comment Share on other sites More sharing options...
FreeFry Posted June 20, 2008 Share Posted June 20, 2008 (edited) There's probably a more neat way of doing it, but I solved your problem by doing this:ProcessClose("Winamp.exe") ;// Example _UpdateTray() Func _UpdateTray() Local $iMode = Opt("WinTitleMatchMode", 4) Local $hControl = ControlGetHandle("[CLASS:Shell_TrayWnd]", "", "[CLASSNN:ToolbarWindow321]") Local $acSize = WinGetClientSize($hControl) For $x = 0 To $acSize[0] Step 5 For $y = 0 To $acSize[1] Step 5 DllCall("user32.dll", "lparam", "SendMessage", "hwnd", $hControl, "int", 0x0200, "wparam", 0, "lparam", BitOR($y*0x10000, BitAND($x, 0xFFFF))) Next Next Opt("WinTitleMatchMode", $iMode) EndFuncEdit:Updated so it doesn't move the mouse(nor any need to include the Toolbar UDF). Edited June 24, 2008 by FreeFry Link to comment Share on other sites More sharing options...
anixon Posted June 20, 2008 Author Share Posted June 20, 2008 There's probably a more neat way of doing it, but I solved your problem by doing this: #Include <GuiToolBar.au3> ProcessClose("Winamp.exe") ;// Example _UpdateTray() Func _UpdateTray() Local $iMode = Opt("WinTitleMatchMode", 4) Local $hControl = ControlGetHandle("[CLASS:Shell_TrayWnd]", "", "[CLASSNN:ToolbarWindow321]") Local $iButtons = _GUICtrlToolbar_ButtonCount($hControl) For $i = 0 To $iButtons Local $iCmd = _GUICtrlToolbar_IndexToCommand($hControl, $i) _GUICtrlToolbar_ClickButton($hControl, $iCmd, "0", False, 1, 0) Next Opt("WinTitleMatchMode", $iMode) EndFunc Excellent It worked for me but I don't know how it works for example how did not know which process I closed to many other questions to list....... Thanks a lot much appreciated Link to comment Share on other sites More sharing options...
TehWhale Posted June 20, 2008 Share Posted June 20, 2008 (edited) Excellent It worked for me but I don't know how it works for example how did not know which process I closed to many other questions to list.......Thanks a lot much appreciated It doesn't need to know what process you closed. It just 'refreshes' the toolbar. Edited June 20, 2008 by JasonB Link to comment Share on other sites More sharing options...
anixon Posted June 20, 2008 Author Share Posted June 20, 2008 It doesn't need to know what process you closed. It just 'refreshes' the toolbar.Fantastic - so much to learn so little time..... Ant Link to comment Share on other sites More sharing options...
FreeFry Posted June 20, 2008 Share Posted June 20, 2008 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now