[spambayes-dev] RE: [Spambayes] Outlook Envelope Tray Icon

Kenny Pitt kennypitt at hotmail.com
Fri Nov 7 13:13:34 EST 2003

Bob Chojnacki wrote:
> Hi,
> I really like SpamBayes and the Outlook plugin.  It is working much
> better than other spam filters, considering I get 85-95% spam. I am
> currently using version 008.1.  I read your FAQ about the problems
> with making the Outlook envelope tray icon go away.  (I am also not
> sure if this is the right email address to send this comment, so
> please bear with me if it isn't.) 
> Is the following link helpful? (Keep in mind that I am not a Windows
> programmer):
> 	http://www.slipstick.com/dev/code/clearenvicon.htm

Thanks for the link.  I created the following code to implement this in
the Outlook plugin and attached it to a menu item for testing.  It was,
in fact, successful in removing the new mail envelope from the taskbar.
Now, the *really* tricky part is figuring out when to remove the icon.


def RemoveNewMailIcon():
    win32gui.EnumWindows(_removeIconCallback, None)
def _removeIconCallback(hwnd, extra):
    # Check for Outlook window class.
    if win32gui.GetClassName(hwnd) == "rctrl_renwnd32":
        # Got the correct class, but we need to make sure window title
        # empty because there may be other top-level Outlook windows.
        if win32gui.GetWindowText(hwnd) == "":
            return not _killNewMailIcon(hwnd)
            return True
        return True
def _killNewMailIcon(hwnd):
    nid = (hwnd, 0)
    if not win32gui.Shell_NotifyIcon(win32gui.NIM_DELETE, nid):
        return False
        win32gui.SendMessage(hwnd, WUM_RESETNOTIFICATION, 0, 0)
        return True


Kenny Pitt

More information about the spambayes-dev mailing list