Click to See Complete Forum and Search --> : How to put minimize an icon to windows system tast bar


Amendra
October 2nd, 1999, 01:42 PM
How can i dispaly a background application in the windows system tray as an icon only.
Amendra

AndyK
October 2nd, 1999, 02:13 PM
put this code into a module

DefInt A-Z

Declare Function Shell_NotifyIconA Lib "SHELL32" (byval dwMessage as Long, lpData as NOTIFYICONDATA) as Long

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

Global Const NIM_ADD = &H0&
Global Const NIM_MODIFY = &H1
Global Const NIM_DELETE = &H2
Global Const NIF_MESSAGE = &H1
Global Const NIF_ICON = &H2
Global Const NIF_TIP = &H4
Global Const WM_MOUSEMOVE = &H200
Global NI as NOTIFYICONDATA



on form
1) put picture box
2) place an icon into that picture box
put this code into into command1, form_load, etc (that's to set the picturebox as tray icon)

NI.cbSize = len(NI) 'set the length of this structure
NI.hwnd = Picture1.hwnd 'control to receive messages from
NI.uID = 0 'uniqueID
NI.uID = NI.uID + 1
NI.uFlags = NIF_MESSAGE Or NIF_ICON Or NIF_TIP 'operation flags
NI.uCallbackMessage = WM_MOUSEMOVE 'recieve messages from mouse activities
NI.hIcon = Picture1.Picture 'the location of the icon to display
NI.szTip = "System Tray icon" + Chr$(0) 'the tool tip to display
result = Shell_NotifyIconA(NIM_ADD, NI) 'add the icon to the system tray




put this to remove tray icon from systray

result = Shell_NotifyIconA(NIM_DELETE, NI) 'removes the icon from the tray



this code goes to Picture1_MouseMove

Dim Msg as Long
Msg = (X And &HFF) * &H100

Select Case Msg
Case 0 'mouse moves
' here put what to do if mouse moves
Case &HF00 'left mouse button down
' here put what to do if left mouse button down
Case &H1E00 'left mouse button up
' here put what to do when left mouse button up
Case &H2D00 'left mouse button double click
' etc
Case &H3C00 'right mouse button down
' etc
Case &H4B00 'right mouse button up
' etc
Case &H5A00 'right mouse button double click
' etc
End Select



hope this will work

Amendra
October 3rd, 1999, 02:20 PM
Thanks a lot but now I have a bigger problem.My problem is how to get things done when I click on that icon on the system tray. This is urgent.Thanks a lot for the ealier advice.
Amendra