Web development India freelance website designer developer India SEO

{\rtf1\ansi\ansicpg1252\deff0\deflang1044{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\f0\fs17 The following code removes the new mail icon (an envelope) that outlook places in the system tray when you receive a new mail message.
\par
\par This code would typically be called when the Application.NewMail event fires. eg,
\par
\par Private Sub Application_NewMail()
\par OutlookRemoveMailIcon
\par End Sub
\par
\par Source Code:
\par
\par Option Explicit
\par
\par Private Type NOTIFYICONDATA
\par cbSize As Long
\par hwnd As Long
\par uID As Long
\par uFlags As Long
\par uCallbackMessage As Long
\par hIcon As Long
\par szTip As String * 64
\par End Type
\par
\par Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
\par Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
\par Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
\par Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
\par Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
\par Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
\par
\par
\par 'Purpose : Removes the name mail icon from outlook
\par 'Inputs : [bDontShowAgain] If True the new mail icon won't show again when you receive a new mail message.
\par 'Outputs : Returns True if a Outlook mail icon was deleted
\par
\par
\par Public Function OutlookRemoveMailIcon(Optional bDontShowAgain As Boolean = False) As Boolean
\par Const WUM_RESETNOTIFICATION As Long = &H407
\par Const GW_HWNDNEXT As Long = 2, GW_HWNDFIRST = 0
\par Const NIM_DELETE As Long = &H2
\par
\par Dim sBuffer As String * 64
\par Dim lhShellTray As Long
\par Dim lhTrayWindow As Long
\par Dim lhIcon As Long
\par Dim tNotify As NOTIFYICONDATA
\par
\par 'Get the Taskbar handle
\par lhShellTray = FindWindow("Shell_TrayWnd", vbNullString)
\par 'Find the first window on the task bar
\par lhIcon = GetWindow(lhShellTray, GW_HWNDFIRST)
\par
\par Do While lhIcon
\par 'Loop through each window in the task bar, checking the class name
\par Call GetClassName(lhIcon, sBuffer, 64)
\par If Left$(sBuffer, 14) = "rctrl_renwnd32" Then
\par 'Found correct class name, try to remove icon
\par 'Setup a notify icon structure
\par tNotify.cbSize = Len(tNotify)
\par tNotify.hwnd = lhIcon
\par tNotify.uID = 0
\par 'Try to delete the system tray icon
\par If Shell_NotifyIcon(NIM_DELETE, tNotify) Then
\par 'Deleted icon
\par If bDontShowAgain = False Then
\par 'Reset the mail engine (else new mail icons won't appear again)
\par Call SendMessage(lhIcon, WUM_RESETNOTIFICATION, 0&, 0&)
\par End If
\par OutlookRemoveMailIcon = True
\par Exit Do
\par End If
\par End If
\par 'Get the next taskbar window
\par lhIcon = GetWindow(lhIcon, GW_HWNDNEXT)
\par Loop
\par End Function
\par }
Deleting the "New Mail Icon" from outlook

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150

India web developer web development India | India web development company India ecommerce web developer