1. Create a VB6 project and set the ShowInTaskBar attribute of Form1 to False.
2. Menu: Project-add module press "open" to add a new module named Module1 and save it as Module1.bas
3. Write the following code in Module1:
Option Explicit
Public Const MAX_TOOLTIP As Integer = 64
Public Const NIF_ICON = & H2
Public Const NIF_MESSAGE = & H1
Public Const NIF_TIP = & H4
Public Const NIM_ADD = & H0
Public Const NIM_DELETE = & H2
Public Const WM_MOUSEMOVE = & H200
Public Const WM_LBUTTONDOWN = & H201
Public Const WM_LBUTTONUP = & H202
Public Const WM_LBUTTONDBLCLK = & H203
Public Const WM_RBUTTONDOWN = & H204
Public Const WM_RBUTTONUP = & H205
Public Const WM_RBUTTONDBLCLK = & H206
Public Const SW_RESTORE = 9
Public Const SW_HIDE = 0
Public nfIconData As policyicondata
Public Type policyicondata
CbSize As Long
HWnd As Long
UID As Long
UFlags As Long
UCallbackMessage As Long
HIcon As Long
SzTip As String * MAX_TOOLTIP
End Type
Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Public Declare Function shell_policyicon Lib "shell32.dll" Alias "shell_policyicona" (ByVal dwMessage As Long, lpData As policyicondata) As Long
4. Write the following code in the Load event of Form1:
Private Sub Form_Load ()
'Put the program in System Tray ======================================== === System Tray Begin
With nfIconData
. HWnd = Me. hWnd
. UID = Me. Icon
. UFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
. UCallbackMessage = WM_MOUSEMOVE
. HIcon = Me. Icon. Handle
'Defines the Tip displayed when you move the cursor over the tray.
. SzTip = App. Title + "(version" & App. Major & "." & App. Minor & "." & App. Revision & ")" & vbNullChar