Results 1 to 4 of 4

Thread: Balloon Tips for Systray Icons

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    flanders, nj 07836
    Posts
    110

    Red face

    I'm so annoyed! The new control's give you the ability to add balloon tips to your systray icons HOWEVER microsoft has all the code explained in C. I do not know C at all and I can't follow it. Another complaint.. they have const's in there like NIF_INFO that I guess are defined in some header files, however I have no clue what the values are and I can't find them anywhere on the sight...

    Does anyone this they can crack this and convert it?
    Here is the link that microsoft has about all this. Any help would be appreciated. Thank you!

    http://msdn.microsoft.com/library/ps...sample_balloon

  2. #2
    Guest
    You could use this code. (Tooltip line is bold)

    Code:
    'Module code:
    
    Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
    Public Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
    
    Public Const NIM_ADD = &H0
    Public Const NIM_MODIFY = &H1
    Public Const NIM_DELETE = &H2
    Public Const NIF_MESSAGE = &H1
    Public Const NIF_ICON = &H2
    Public Const NIF_TIP = &H4
    Public Const WM_LBUTTONUP = &H202
    Public Const WM_RBUTTONUP = &H205
    Public Const WM_MOUSEMOVE = &H200
    
    
    Public Type NOTIFYICONDATA
      cbSize As Long
      hwnd As Long
      uId As Long
      uFlags As Long
      ucallbackMessage As Long
      hIcon As Long
      szTip As String * 64
    End Type
    
    Public VBGTray As NOTIFYICONDATA
    
    
    'Form Declarations:
    Private Sub GoSystemTray()
      VBGTray.cbSize = Len(VBGTray)
      VBGTray.hwnd = Me.hwnd
      VBGTray.uId = vbNull
      VBGTray.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
      VBGTray.ucallbackMessage = WM_MOUSEMOVE
      VBGTray.hIcon = Me.Icon
      'tool tip text
      VBGTray.szTip = "Didn't your mother ever tell you?  It's not polite to point?" & vbNullChar
      Call Shell_NotifyIcon(NIM_ADD, VBGTray)
      App.TaskVisible = False   'remove application from taskbar
      Me.Hide
    End Sub
    
    'Form Code:
    
    Private Sub Form_MouseMove(button As Integer, Shift As Integer, X As Single, Y As Single)
      Static lngMsg As Long
      Static blnFlag As Boolean
      Dim result As Long
    lngMsg = X / Screen.TwipsPerPixelX
      If blnFlag = False Then
            blnFlag = True
            Select Case lngMsg
            'right-click
            Case WM_RBUTTONUP
              result = SetForegroundWindow(Me.hwnd)
              PopupMenu MyPopUpMenu
             Case WM_LBUTTONUP
              result = SetForegroundWindow(Me.hwnd)
              PopupMenu MyPopUpMenu
            End Select
            blnFlag = False
     End If
    End Sub
    
    Private Sub Form_Resize()
    If Me.WindowState = 1 Then
    Call GoSystemTray
    ElseIf Me.WindowState = 0 Then
      VBGTray.cbSize = Len(VBGTray)
      VBGTray.hwnd = Me.hwnd
      VBGTray.uId = vbNull
      Call Shell_NotifyIcon(NIM_DELETE, VBGTray)
    End If
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
      VBGTray.cbSize = Len(VBGTray)
      VBGTray.hwnd = Me.hwnd
      VBGTray.uId = vbNull
      Call Shell_NotifyIcon(NIM_DELETE, VBGTray)
      Unload Me
      Set Form1 = Nothing
      End
    End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    flanders, nj 07836
    Posts
    110
    Sorry, I guess i didn't explain myself well..

    I already have tooltip coding in there, I want to be able to popup balloons next to my icon in the systray, kinda like the how the 2000 Critical Notifcations program does. It can only be done in 2000 according to microsoft.. That is what I want..

    I should be able to just add a few things to the struct and define them before the sendmessage call , however it's not working.

  4. #4
    Lively Member eric445's Avatar
    Join Date
    Aug 2000
    Location
    Seattle, WA (USA)
    Posts
    70

    Talking

    I found a great control that will do it. Only problem is that you cannot click on the ballon (as far as I know).

    I attached the control to this message

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width