Squirm
09-20-2001, 11:05 AM
This seems to be a rather *hot* topic lately, putting an application icon into the System Tray. For those of you that know the code and understand it, thats great, for those that dont want to be dabbling into API, there is another way.....
On one of your Visual Basic install CDs (I have been told CD 3) you will find the following directroy: common\tools\vb\unsupprt\systray ...... in that folder you should find a SysTray project.
1) Open the project
2) Click 'File' on the menu
3) Click 'Make SysTray.OCX'
4) Compile the OCX to your Windows/System directory
now, thats the easy part..........
5) Open up your VB project
6) Click 'Project' on the menu
7) Click 'Components'
8) Scroll down until you find 'SysTray.OCX' or 'System Tray Icon Control' or similar
9) Check it and click OK
You should now see a new control in your controls tab - 'cSysTray'.. Add one anywhere on your form (it is not visible at runtime)...
10) Select your new control
11) Set the InTray property to True
12) Select an icon for the control.
13) Add a TrayTip if you wish (text that pops up when the mouse moves over the icon)
Now, your icon is setup ready for use.... it has the following events:
MouseDown, MouseUp, MouseDblClick, MouseMove
There, ready for use....... the icon will sit in the systray while the app is running and you can control what happens from it using the events....... in my app the following lines appear:
Private Sub clsSysTray_MouseDown(Button As Integer, Id As Long)
frmChat.Show
End Sub
have fun.........
On one of your Visual Basic install CDs (I have been told CD 3) you will find the following directroy: common\tools\vb\unsupprt\systray ...... in that folder you should find a SysTray project.
1) Open the project
2) Click 'File' on the menu
3) Click 'Make SysTray.OCX'
4) Compile the OCX to your Windows/System directory
now, thats the easy part..........
5) Open up your VB project
6) Click 'Project' on the menu
7) Click 'Components'
8) Scroll down until you find 'SysTray.OCX' or 'System Tray Icon Control' or similar
9) Check it and click OK
You should now see a new control in your controls tab - 'cSysTray'.. Add one anywhere on your form (it is not visible at runtime)...
10) Select your new control
11) Set the InTray property to True
12) Select an icon for the control.
13) Add a TrayTip if you wish (text that pops up when the mouse moves over the icon)
Now, your icon is setup ready for use.... it has the following events:
MouseDown, MouseUp, MouseDblClick, MouseMove
There, ready for use....... the icon will sit in the systray while the app is running and you can control what happens from it using the events....... in my app the following lines appear:
Private Sub clsSysTray_MouseDown(Button As Integer, Id As Long)
frmChat.Show
End Sub
have fun.........