I've written some code that would put my application in system tray!! Now i would like to change the icon everytime a process starts!! how can i do this?? any help!!
I've never written applications for the System Tray but to change an aplications icon you go into project and properties and change it in there. I assume that would change the icon which appears in your system tray also.
Mark
The key to immortality is to make a big impression in this life!!
yes but since i've searched for the code on the internet i have no clue what it does ..... only through logic i can understand!!
Thanks strongm for your help....
I have this code which upon running it works perfectly!! I have a timer that runs code every 5min... while running this code i would like it to change icon! but nothing happens!! this is the code i have and used
Public Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Public Const NIM_ADD = &H0
Public Const NIM_MODIFY = &H1
Public Const NIM_DELETE = &H2
Public Const NIF_MESSAGE = &H1
Public Const NIF_ICON = &H2
Public Const NIF_TIP = &H4
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 HWND_TOPMOST = -1
Public nid As NOTIFYICONDATA
Public 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 Sub Form_Resize()
With nid
.cbSize = Len(nid)
.hwnd = Me.hwnd
.uId = vbNull
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallBackMessage = WM_MOUSEMOVE
.hIcon = Me.Icon
.szTip = Me.Caption & vbNullChar
End With
Shell_NotifyIcon NIM_ADD, nid
End Sub
Ok, given the code you already have, the following is the sort of thing you need to do: [tt]
' In this example I am simply getting an icon handle from one of the images in
' an ImageList control. Your icon handle may come from somewhere else, eg a form's icon
' (as it does in your posted code for the form's resize event)
With nid
.hIcon = ImageList1.ListImages(1).ExtractIcon.Handle
End With
Shell_NotifyIcon NIM_MODIFY, nid
Fori
You might consider giving the man a STAR for his helpful/expert post! I notice you haven't given any stars yet. It's not painful, just click on the 'Mark this post as a helpful/expert post' link at the bottom of the appropriate answer.
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.