Sign in to follow this  
Followers 0
anixon

TrayIcons

6 posts in this topic

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.. :)

Share this post


Link to post
Share on other sites



#2 ·  Posted (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)
EndFunc

Edit:

Updated so it doesn't move the mouse(nor any need to include the Toolbar UDF).

Edited by FreeFry

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by JasonB

Share this post


Link to post
Share on other sites

It doesn't need to know what process you closed. It just 'refreshes' the toolbar.

Fantastic - so much to learn so little time..... Ant :)

Share this post


Link to post
Share on other sites
:)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0