Search the Community
Showing results for tags 'NotifyIconOverflowWindow'.
-
Remove orphaned Notification Area toolbar buttons (icons) left behind after an application crash or process close Edit: Dec 5 2k11 Added _RefreshNotificationAreaIcons() UDF for Win7/2008R2 - x86/x64 Updated for 64 bit OS support. I suppose this issue will finally be put to rest in Win 8... Orphaned icons still hang around in the User Promoted Notification Area and Overflow Notification Area in Win 7, but the system removes orphaned icons from the System Promoted Notification Area after 30 seconds. Now, why didn't they do that for the other two areas? The only use I have for this is replacing the _RefreshSystemTray() code in the SciTE AutoIt3Wrapper script. /Edit ------------------------------- Win 2k/XP/2003 Version - x86 32 bit only tested on Win2000, WinXP and Vista Synopsis: Each taskbar Notification Area toolbar button/icon has an application window handle associated with it that receives the notification messages. If the window handle owner process no longer exists the orphaned button can be deleted. The window handle and application identifier of the icon must match to allow deletion with Shell_NotifyIcon API. (application identifier value is set by developer, so value is sometimes only 0 or 1 (AutoIt EXEs return 1)) [Disclaimer] _RefreshTrayIcons() accesses the explorer memspace so it will inherently have a risk of an access violation explorer crash under unforeseen error conditions or third party shell modifications. this function uses the same memory reading code used in the UDF controls functions. even though there is error handling and limited write permission to explorer memspace, personal use only is recommended. use Valik's _RefreshSystemTray() mouse over method in an enterprise environment as it is fail-safe (no explorer memory access) Don't call this function from a service: MicroSoft's Raymond Chen at 'The Old New Thing' blog, states Shell_NotifyIcon API should never be called from a service. Edit: Looks like the don't run in a service warning is about creating a tray icon for a service which apparently is a security risk - the system not allowing explorer to send messages to a higher security context service process (notification messages). The UDF sends messages to and reads from explorer memory but does not receive messages so I don't think that warning is applicable. This method of clearing icons is a hack and not recommended for use in production code as mentioned by posters to Raymond Chen's Blog, but certainly suitable for private use. [/Disclaimer] Thanks to: Tuape's SysTray UDF for ideas wraithdu's NOTIFYICONDATA code Get Shell_NotifyIcon to show tray balloon tip NOTIFYICONDATA Structure http://msdn.microsoft.com/en-us/library/bb773352.aspx Valik's mouse over method _RefreshSystemTray(), Remove dead icons from Notification area and MSDN and other sources Tested on: Win 2000, Win XP and Vista Untested: Win 2003, Win 2008 and Win 7 (haven't looked into changes in tray for above OS, maybe MS finally checks if buttons are abandoned by closed processes?...) Untested on 64 bit OS - not currently supported Examples: _RefreshNotificationAreaIcons() - Vista/2008/Win7/2008R2 - x86/x64 included in UDF _RefreshSystemTray() - Win2k/XP/2003 - x86 only UDF: _RefreshNotificationAreaIcons() UDF - Vista/2008/Win7/2008R2 - x86/x64 64 bit OS support. Tested on Win 7-Win 2008R2 _RefreshNotificationAreaIcons.au3 _RefreshTrayIcons() UDF - Win2k/XP/2003 - x86 only _RefreshTrayIcons.au3 Examples _RefreshTrayIcons_examples.au3
- 6 replies
-
- Shell_NotifyIcon
- NotifyIconOverflowWindow
- (and 2 more)