Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retracting a Systray balloon message? 1

Status
Not open for further replies.

JFoushee

Programmer
Oct 23, 2000
200
0
0
US
I'm using well-publicized code for featuring a System Tray icon with my program.

The System Tray icon "balloons" a message when a warning occurs, using the Shell_NotifyIcon procedure.

However, I notice when I arrive in the morning and unlock my workstation that a balloon from 10 hours ago is still awaiting a click, even though the warning has long subsided.

Is there a way to programmatically reverse the call to balloon a message?

Here is the code I'm using to present the balloon:
Code:
Public Sub ShellTrayModifyTip(MyHeader As String, MyText As String, MyType As String)

   Dim nid As NOTIFYICONDATA

   If NOTIFYICONDATA_SIZE = 0 Then SetShellVersion
   
   With nid
      .cbSize = NOTIFYICONDATA_SIZE
      .hWnd = frmGUI.hWnd
      .uID = frmGUI.Icon
      .uFlags = NIF_INFO
      
      Select Case MyType
        Case "Warning": .dwInfoFlags = NIIF_WARNING
        Case "Error":   .dwInfoFlags = NIIF_ERROR
      End Select

      .szInfoTitle = MyHeader & vbNullChar
      .szInfo = MyText & vbNullChar
   End With

   Call Shell_NotifyIcon(NIM_MODIFY, nid)

End Sub

(The refresh of this program is every minute, so I'd prefer not to remove/re-add the Systray icon when no errors are present. Doing this is noticable and irritating in the System Tray.)

 
Shell_NotifyIcon hides the balloon if the function is called with NIF_INFO flag and .szInfo member set to an empty string. Thus you can hide your balloon by calling your ShellTrayModifyTip function with empty arguments.

[tt]ShellTrayModifyTip vbNullString, vbNullString, vbNullString[/tt]
or
[tt]ShellTrayModifyTip "", "", ""[/tt]
 
This looks very promising under initial review. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top