home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Mouse_Sens20941612172007.psc / AniTray.bas < prev    next >
BASIC Source File  |  2007-12-17  |  2KB  |  80 lines

  1. Attribute VB_Name = "modTrayManager"
  2. Public Const WM_LBUTTONUP = &H202
  3. Public Const WM_RBUTTONUP = &H205
  4.  
  5. Global Const WM_MOUSEMOVE = &H200
  6. Global Const NIM_ADD = 0&
  7. Global Const NIM_DELETE = 2&
  8. Global Const NIM_MODIFY = 1&
  9. Global Const NIF_ICON = 2&
  10. Global Const NIF_MESSAGE = 1&
  11. Global Const ABM_GETTASKBARPOS = &H5&
  12.  
  13. Type RECT
  14.         Left As Long
  15.         Top As Long
  16.         Right As Long
  17.         Bottom As Long
  18. End Type
  19.  
  20. Type NOTIFYICONDATA
  21.         cbSize As Long
  22.         hwnd As Long
  23.         uID As Long
  24.         uFlags As Long
  25.         uCallbackMessage As Long
  26.         hIcon As Long
  27.         szTip As String * 64
  28. End Type
  29.  
  30. Type APPBARDATA
  31.         cbSize As Long
  32.         hwnd As Long
  33.         uCallbackMessage As Long
  34.         uEdge As Long
  35.         rc As RECT
  36.         lParam As Long
  37. End Type
  38.  
  39. Global Notify As NOTIFYICONDATA
  40. Global BarData As APPBARDATA
  41.  
  42. Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
  43. Private Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long
  44.  
  45. Sub modIcon(Form1 As Form, IconID As Long, Icon As Object, ToolTip As String)
  46.     Dim Result As Long
  47.     Notify.cbSize = 88&
  48.     Notify.hwnd = Form1.hwnd
  49.     Notify.uID = IconID
  50.     Notify.uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
  51.     Notify.uCallbackMessage = WM_MOUSEMOVE
  52.     Notify.hIcon = Icon
  53.     Notify.szTip = ToolTip & Chr$(0)
  54.     Result = Shell_NotifyIcon(NIM_MODIFY, Notify)
  55. End Sub
  56.  
  57. Sub AddIcon(Form1 As Form, IconID As Long, Icon As Object, ToolTip As String)
  58.     Dim Result As Long
  59.     BarData.cbSize = 36&
  60.     Result = SHAppBarMessage(ABM_GETTASKBARPOS, BarData)
  61.     Notify.cbSize = 88&
  62.     Notify.hwnd = Form1.hwnd
  63.     Notify.uID = IconID
  64.     Notify.uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
  65.     Notify.uCallbackMessage = WM_MOUSEMOVE
  66.     Notify.hIcon = Icon
  67.     Notify.szTip = ToolTip & Chr$(0)
  68.     Result = Shell_NotifyIcon(NIM_ADD, Notify)
  69. End Sub
  70.  
  71. Sub delIcon(IconID As Long)
  72.     Dim Result As Long
  73.     Notify.uID = IconID
  74.     Result = Shell_NotifyIcon(NIM_DELETE, Notify)
  75. End Sub
  76.  
  77.  
  78.  
  79.  
  80.