system tray

How do you put an application in the
system tray?  I think it is called the
system tray.  I want to put my application
in the lower right corner of the screen.
The area right next to the system time.

the application is an application i wrote
myself.  i would like the application
to put itself in the system tray.  I don't
want to have to do it manually.
ueihpAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcriderCommented:
Read this Microsoft KB Article...

HOWTO: Use the System Tray Directly from Visual Basic
http://support.microsoft.com/support/kb/articles/Q176/0/85.ASP

Cheers!


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Erick37Commented:
Here is another site which demonstrates how to do this. Code is included:

http://www.spnc.demon.co.uk/vb/vbtray.htm
0
JuiletteCommented:
Option Explicit

'systray icon delcares and functions
'
Private Declare Function Shell_NotifyIcon Lib "shell32.dll" _
Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData _
As NOTIFYICONDATA) As Long

Private 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

Private Const NIF_ICON = &H2
Private Const NIF_MESSAGE = &H1
Private Const NIF_TIP = &H4
Private Const NIM_ADD = &H0
Private Const NIM_DELETE = &H2
Private Const NIM_MODIFY = &H1
Private Const WM_MOUSEMOVE = &H200

'You can use NIM_MODIFY in conjunction with changing the
'SysTrayIcon.hIcon property to give the effect of
'an animated System Tray Icon.

'Declare a Variable for the SysTray Icon Data
Private SysTrayIcon As NOTIFYICONDATA

Private Sub Form_Load()

'Create the System Tray Icon Object

        'Image to appear in Tray
        SysTrayIcon.hIcon = Icon
        'Handle of Object to recieve Tray Icon Events
         SysTrayIcon.hwnd = picSysTray.hwnd
        'Caption for Tray Icon, Must End with Chr(0)
        SysTrayIcon.szTip = Caption & Chr(0)
        'Event Triggered When Interacting with Tray Icon
        SysTrayIcon.uCallbackMessage = WM_MOUSEMOVE
        'Parts of Tray Icon we want to setup
        SysTrayIcon.uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
        'Unique Identifier
        SysTrayIcon.uID = 1
        'Size of this Variable in Bytes.
        SysTrayIcon.cbSize = Len(SysTrayIcon)
     
    'Add the Icon to the System Tray
    Shell_NotifyIcon NIM_ADD, SysTrayIcon
End Sub

Private Sub Form_Unload(Cancel As Integer)
Shell_NotifyIcon 2, SysTrayIcon
   
      End

End Sub

Private Sub picSysTray_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Select Case Right(Hex(X), 2)
        Case "00"  ' Mouse Move
      '<<< Put Your Code Here >>>
         
        Case "0F"  ' Left Mouse Down
      '<<< Put Your Code Here >>>
        'If the Window is Minimized, Restore it else Minimize it.
        WindowState = IIf(WindowState = vbNormal, _
                            vbMinimized, vbNormal)
     
        Case "1E"  ' Left Mouse Up
      '<<< Put Your Code Here >>>
     
        Case "3C"  ' Right Mouse Down
      '<<< Put Your Code Here >>>
         
        Case "4B"  ' Right Mouse Up
      '<<< Put Your Code Here >>>
         
        Case "2D"  ' Double Left Click
      '<<< Put Your Code Here >>>
         
        Case "5A"  ' Double Right Click
      '<<< Put Your Code Here >>>
  End Select
End Sub


0
ueihpAuthor Commented:
thanks everyone.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.