Not a Member Yet,
Click here to Register

ID: 459
Viewed: 3303
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Add your own icon to the system tray (found next to the clock on the taskbar)

Highlight all by clicking in box
<!---Declaration--->
Option Explicit
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 NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Const WM_MOUSEMOVE = &H200
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4

Private Declare Function Shell_NotifyIcon Lib "shell32" _
Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid _
As NOTIFYICONDATA) As Boolean

Dim t As NOTIFYICONDATA

Highlight All
<!---Code--->
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

Timer1.Enabled = False

t.cbSize = Len(t)
t.hWnd = Picture1.hWnd
t.uId = 1&

Shell_NotifyIcon NIM_DELETE, t

End Sub

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

If Hex(X) = "1E3C" Then
Me.PopupMenu menu1
End If

End Sub

Private Sub Timer1_Timer()
Static i As Long, img As Long
t.cbSize = Len(t)
t.hWnd = Picture1.hWnd
t.uId = 1&
t.uFlags = NIF_ICON
t.hIcon = Picture1.Picture
Shell_NotifyIcon NIM_MODIFY, t
Timer1.Enabled = True
i = i + 1
If i = 2 Then i = 0
End Sub

Private Sub Form_Load()

t.cbSize = Len(t)
t.hWnd = Picture1.hWnd
t.uId = 1&
t.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
t.ucallbackMessage = WM_MOUSEMOVE
t.hIcon = Picture1.Picture
t.szTip = "System Tray" & Chr$(0)

Shell_NotifyIcon NIM_ADD, t

Timer1.Enabled = True

Me.Hide

App.TaskVisible = False

End Sub

;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 snippetlibrary.com All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!