Unicode Controls & Classes for VB6 - Version 4

clsTrayArea Class

This class permits you to add, remove or change icons or tip messages on the tray area.
When the class terminates, all added icons will be removed from the Tray Area automatically
See the "Sample 1" for a working example.

Enums
Name Description
eBalloonIconTypes
Events
Name Description
Properties
Name Type Description
Message (Long) Gets or sets the Windows message that will be sent from the Tray Area; the default is WM_MOUSEMOVE
hWnd Sets the window handle that will receive notification messages from the Tray Area
Usually one can use a PictureBox.hWnd value
Methods
Name Type Description
AddIcon (Boolean) Adds a specified icon to the Tray Area; returns True if the call succeded
ChangeIcon (Boolean) Changes a certain icon on the Tray Area with the specified one
ChangeTip (Boolean) Changes the tip associated with the specified icon to another
DeleteIcon (Boolean) Removes the specified icon from the Tray Area
GetLastIconID (Long) Returns the last icon identifier added to the Tray Area
PopupMenu Shows a popup menu from the Tray Area and sets the focus to this menu
RemoveAllIcons Removes all icons from the Tray Area; automatically called when the class Terminates
ShowBalloonTip (Boolean) Shows a balloon tip associated with the specified icon
Remarks
Option Explicit

Private Const MK_LBUTTON = &H1 'Left Button
Private Const WM_LBUTTONDOWN = &H201 'Left Button Down
Private Const WM_LBUTTONUP = &H202 'Left Button Up
Private Const MK_RBUTTON = &H2 'Right Button
Private Const WM_RBUTTONDOWN = &H204 'Right Button Down
Private Const WM_RBUTTONUP = &H205 'Right Button Up
Private Const WM_LBUTTONDBLCLK = &H203 'Left Button DblClick

Private moTrayArea As clsTrayArea
Private moWrap As clsCommonWrapper

Private Sub Form_Load()

Set moTrayArea = New clsTrayArea
Set moWrap = New clsCommonWrapper

'The Picture (MouseMove) will catch Tray Area events
moTrayArea.hWnd = picTrayArea.hWnd

'Add one icon to the tray area
moTrayArea.AddIcon 1, "Right click to open the menu", Image1.Picture.Handle

'Show a message
moTrayArea.ShowBalloonTip "Hey, I'm here ;-) " & moWrap.HextoStr("0XJwYzBioGLgYvBicGRQYgAEoGSAZGBkoGQwZIBi8GIAAjBkoGNgYnBiAAQQZKBiAARQZGBjcGQgYpBiAANQZKBkYGSgYpBg==62")
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set moTrayArea = Nothing
End Sub

Private Sub picTrayArea_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
Select Case x
Case WM_RBUTTONUP: 'right up
moTrayArea.PopupMenu MDIForm1, MDIForm1.mnuSamples
End Select
End Sub