Hi rnd,
I've done this before - I take it you are using VB6. Below is the
basic code you'll need. You'll have to drop the code in to make it
work properly with your app.
Use Public Declare Function Shell_NotifyIcon Lib "shell32" _
Alias "Shell_NotifyIconA" _
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean API,
and a picture box - You'll have some syntax something like this: -
'constants required by Shell_NotifyIcon API call:
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 'Button down
Public Const WM_LBUTTONUP = &H202 'Button up
Public Const WM_LBUTTONDBLCLK = &H203 'Double-click
Public Const WM_RBUTTONDOWN = &H204 'Button down
Public Const WM_RBUTTONUP = &H205 'Button up
Public Const WM_RBUTTONDBLCLK = &H206 'Double-click
Public Nid As NOTIFYICONDATA
private sub form_load()
With Nid
.cbSize = Len(Nid)
.hwnd = FMain.hwnd
.uId = vbNull
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallBackMessage = WM_MOUSEMOVE
.hIcon = FMain.Icon
.szTip = "Some text" & vbNullChar
End With
' Add Icon to SysTray
Shell_NotifyIcon NIM_ADD, Nid
end sub
' Change Icon
Public sub ChangeIcon()
me.icon = imageicons.ListImages.Item(1).Picture
refreshnid
end sub
' Refresh system tray icon
Public sub RefershNid()
With Nid
.cbSize = Len(Nid)
.hwnd = FMain.hwnd
.uId = vbNull
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallBackMessage = WM_MOUSEMOVE
.hIcon = FMain.Icon
.szTip = "What ever you want" & vbNullChar ' U must add
End With
Shell_NotifyIcon NIM_MODIFY, Nid
end sub
Private Sub Form_Unload(Cancel As Integer)
' Remove the Icon from the System Tray
Shell_NotifyIcon NIM_DELETE, Nid
end sub
--- In [EMAIL PROTECTED], "Rick Rose" <[EMAIL PROTECTED]> wrote:
> Do you want to change the systray icon? If so, use a picture box to
> hold your icon picture. Then change the picture in the picture box.
> Or, use 2 picture boxes. Each holding a different picture.
> Me.icon=picture1.picture
>
> Only in theory. It is not tested. That might work with the regular
> icon as well.
>
> -----Original Message-----
> From: rnd [mailto:[EMAIL PROTECTED]
> Sent: Saturday, May 15, 2004 12:50 PM
> To: [EMAIL PROTECTED]
> Subject: [vbhelp] Changing Program Icon at runtime
>
> How do I change the icon of the form at runtime??... to show the
user
> its
> processing..
>
> btw, many thanks for the help with the listview, worked well:)
>
>
>
> ----- Original Message -----
> From: "Chad" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, May 12, 2004 9:35 PM
> Subject: RE: [vbhelp] Re: Simple database question (I guess)
>
>
> > > Worked first time.......................
> > > Thanks Chad, I have spent hours on this - YOU ARE THE MAN
> >
> > You're welcome, that's what the group is for. Just wish I had more
> time to
> > participate!
> >
> > -Chad
> >
> >
>
>
>
>
> '// =======================================================
> Rules : http://ReliableAnswers.com/List/Rules.asp
> Home : http://groups.yahoo.com/group/vbHelp/
> =======================================================
> Post : [EMAIL PROTECTED]
> Join : [EMAIL PROTECTED]
> Leave : [EMAIL PROTECTED]
> '// =======================================================
>
> Yahoo! Groups Links
'// =======================================================
Rules : http://ReliableAnswers.com/List/Rules.asp
Home : http://groups.yahoo.com/group/vbHelp/
=======================================================
Post : [EMAIL PROTECTED]
Join : [EMAIL PROTECTED]
Leave : [EMAIL PROTECTED]
'// =======================================================
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/vbhelp/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/