Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Refresh System Tray? Program Closed, But Icon Stays *RESOLVED*


Alright, a user can close an external program from within mine if they want. That program has a system tray icon. However, when the user closes the external program, the program's system tray icon remains. The only way I can get it to disappear is if I hover my mouse over its icon in the system tray.

Is there a way to refresh the system tray or somehow make the icon disappear? This has me stumped. Thanks in advance!



Edited by - Marce22 on 6/9/2005 6:14:50 AM




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Remove System Tray Icon? Refresh Systray?
Alright, a user can close an external program from within mine if they want. That program has a system tray icon. However, when the user closes the external program, the program's system tray icon remains. The only way I can get it to disappear is if I hover my mouse over its icon in the system tray.

Is there a way to refresh the system tray or somehow make the icon disappear? This has me stumped. Thanks in advance!

*Resolved* Removing Taskbar Icon In Run-time (NOT System Tray Icon)
I wrote my own mp3 player ('cause Winamp sucks ), and one of the features is a very small, unobtrusive window:

I need to remove the taskbar icon, 'cause it looks dumb with a blank icon among the others.

Anyone have any ideas? All searches keep pointing to system tray icons

___________________________
Dave Applegate
Microsoft VB MVP, ACE [FAQs]
My friend has a trophy wife, but apparently she wasn't in first place.

Edited by - Metallisoft on 3/15/2004 1:39:05 PM

System Tray Icon? [RESOLVED!]
Yes i have searched, all results show "Unstable code"

Does anybody know of "Reliable" code to minimize my app to the system tray and show an icon? Also if possible, seeming as im using the Smart Menu XP control, could i show a popup menu using this control when the icon is clicked?

THANKS

How Do I Put My Program Icon In System Tray?
I know this has been brought up a number of times before, but I'm still lost. People have mentioned the Windows API and a .ocx but I'm still lost. I don't think I have that .ocx. So how would I go about making my program have its icon in the system tray?

Program Icon In System Tray How?
How do I make my program to appear as its icon in the system tray when minimised? (just like Go!Zilla or NetSonic)

Minimise Program To The System, Tray With Icon
hi there

anyone know how i can minimise my program to the system, tray and have an icon appear.

also, how easy is it to add a context menu to the systray for my app

cheers

jamie

Taking Another Program's Icon Out Of The System Tray
i know there is code to put your program in the system tray, and remove it... but can you remove a different program from the system tray??

Help With Putting Icon On System Tray When Program Is Minimized.
Hi , i'd like to find out a way to set it up so when you minamize my Chat program it goes into the system try? anyone know how to go about this?Thanks,

Travis

Getting A Program Icon Into My System Tray Or Whatever The Icons Next To The Clock
Hey guys I see all of these neat progs that add thier own icon to the system tray or something.

Can vb 6 do that?

I have a icon called mhxav31.ico and a program file called mhxav31free.exe

thanks!

PS: when I right click on the icon in the sys tray I would like a menu to open up ? how would i do that?

What's In The System Tray (Not Putting A Icon In The Tray)
Does anyone know of a way to find out what icons are registered and retrieve their NOTIFYICONDATA.  Or if you can't find out which ones are already in the tray do you know of a way to be notified when new icons are added using Shell_NotifyIcon?



System Tray (Refresh)
I have a server program set to run in the system tray.. It uses the code from this link

http://vbnet.mvps.org/index.html?cod...otifybasic.htm


Everything is all fine and dandy except for one thing.. There's several spots in the program where it will close and restart itself by using the Shell command. The problem is when it closes itself, it leaves the icon in the system tray.

I have to run my mouse over the icon and it will dissapear. Is there a way to refresh the systemtray to make it get rid of that icon so that when i check the server i dont see that icon on there 500 times.

Refresh System Tray
Is there anyway to refresh the system tray, because when i kill my icon it stays till i wave my mouse over it. Or is there another way to do it.

Show Icon In System Tray When My System Starts
Hi all

I have done an application in VB6 which when minimized sits in the system tray.
Till this point its working fine.
but i need to do some more modification for this.

I want the application Icon to appear in the system tray when the system(CPU) starts (like yahoo messenger icon sits in sytem tray as soon as the system starts).

can anyone help me with the code.

Thanks in advance.

regards
Rajmv

System Tray Refresh & Creating A Txt File
HI,


When my app is unloaded the icon is removed from the tray, however it is still there until the user puts the cursor over the icon, so after i have removed it, how can i refresh it so that the icon also disapears instantly.


Also how do i create a file (i.e. a txt file)?


Thanks

Updating Icon In Icon Tray ( The One Next To The Clock) *RESOLVED*
Hey all!

I have an icon of my app loaded in the icon tray ( Is the one next to the clock... isnt it? ) So... I need to update the icon sometimes, as ICQ does. I am using the delete/insert method to do this... But I would like to avoid this kind of method cause it makes the icon tray "shake". I did read sometime ago, a code that adds to the api code of icon tray the function to update the icon, without deleting it. But I am not finding it anymore.
Someone have this code to give to me please?

Thanks in advance,

Elminster

Icon In System Tray
hello everybody ,
i have two questions :
1) how can i add an icon of my vb project executable to the system tray ? ( i am using package and deployment wizard)

2) is there any way that i can detect if a file is just been opened or run on my computer i.e if a .avi file is being opened i want to detect this event.

thanks in advance.

App Icon To System Tray?
Hello

I want to know how to put my application icon to system tray. Can anybody give me an example code?

Thanks in advance.

Regards

ATWin

System Tray Icon
I've been working with this system tray icon that I found online.
The picture it's self is stored in a property called "TrayIcon". The type is StdPicture.

I was wondering how I could change the Icon at run time. The LoadPicture function returns a variable of type IPictureDisp, so it doesn't work, I've tried. I've tried ICO files and GIF files.

System Tray Icon
Hai friends.

My programs loads to system tray at windows startup.

After loading xp, on few occations the icon is not shown in tray. but i can see the program running in Task Manager.

[vbcode]
With icodata
.cbSize = Len(icodata)
.hwnd = Me.hwnd
.hIcon = Me.Icon
.szTip = "My program name and version" & Chr$(0) '0 is for truncate
.ucallbackMessage = WM_LBUTTONDOWN
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uId = 1
End With
Shell_NotifyIcon NIM_ADD, icodata
[/vbcode]

Any thing wrong with the codes?
if not what could be the problem you think?

It is remarkable that i have not add any flags to the oprograms startup entry path. i.e. -osboot , /STARTUP , -quiet

System Tray Icon
i have a simple application.

i would like to put an icon of that application in the sistem tray when the user try to close it with the X button.
And to unload it only if the user right click on the system tray icon choosing exit in the menu...



Anyone knows an example of this?

System Tray Icon
how do i get it so that when the user presses the minimize button my prog minimizes to the system tray and not the task bar?

Put Icon In System Tray
How do I put my program's icon in the system tray and have a popup menu come up when you right click on it?

System Tray Icon
I wanna put a icon in the system tray i tryed the tutorial but i cant do that cause i only got 1 CD and it hasnt got it on it and i have downloaded other projects wif stuff on it but i didnt under stand it can someone help me out please

How To Have A System Tray Icon?
I have an application which when running it has a task bar associated to it but I do not know how to make a system tray icon for it and just keep it and un-show the task bar. Something like the winamp, like when you close it the task bar would go away but the system tray icon would remain. How can I achieve this?

System Tray Icon
I have a problem with my systemtray icon. I have been working on it for a while. i fixedone prolem and go t another. Enough rattling.

First let me say I'm using a MDI Form and a child form. I currently hae three ways to exit the application: through a menu bar, a popup menu that you get when right-clicking on the app's systemtray icon, and throught the Close button "X" at the top right of the MDI Form. The icon is unloaded successfully except when I use the Close button "X" at the top right of the MDI Form. When I use the close button the icon stays in the system tray until the user moves the mouse over the icon. Then it disappears. The thing that gets me is that I'm using the exact same code in the other unload event and exit event and it works just fine.

Any help would be great.

Thanks,

Animaul


This code is on the MDI from
Private Sub mnuClose_Click()
removeIcon
End Sub


Private Sub MDIForm_Load()
' 'the form must be fully visible before calling Shell_NotifyIcon
' frmMain.Show
With nid
.cbSize = Len(nid)
.hwnd = frmMain.hwnd
.uId = 1&
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallBackMessage = WM_MOUSEMOVE
.hIcon = frmMain.Icon
'.szTip = "Your ToolTip" & vbNullChar
End With
Shell_NotifyIcon NIM_ADD, nid
End Sub

Private Sub MDIForm_Unload(Cancel As Integer)
'this removes the icon from the system tray
With nid
.cbSize = Len(nid)
.hwnd = frmMain.hwnd
.uId = 1&
End With
Shell_NotifyIcon NIM_DELETE, nid
' Unload frmMain
' Unload frmProgress
' Unload frmDBGrid
' Unload Me
End Sub


Public Sub mPopExit_Click()
'called when user clicks the popup menu Exit command
'this removes the icon from the system tray
removeIcon
End Sub

Private Sub mPopRestore_Click()
'called when the user clicks the popup menu Restore command
Dim Result As Long
Me.WindowState = vbNormal
frmMain.WindowState = vbNormal
Result = SetForegroundWindow(Me.hwnd)
Me.Show
End Sub

Private Sub removeIcon()
With nid
.cbSize = Len(nid)
.hwnd = frmMain.hwnd
.uId = 1&
End With
Shell_NotifyIcon NIM_DELETE, nid
End Sub
****************************************************

This code is on the child form:

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
' 'Event occurs when the mouse pointer is within the rectangular
' 'boundaries of the icon in the taskbar status area.
' 'this procedure receives the callbacks from the System Tray icon.
Dim Result As Long
Dim Msg As Long
'the value of X will vary depending upon the scalemode setting
Msg = X / Screen.TwipsPerPixelX
Select Case Msg
Case WM_LBUTTONUP '514 restore form window
frmMain.WindowState = vbNormal
Result = SetForegroundWindow(mfrmMain.hwnd)
frmMain.Show
Case WM_LBUTTONDBLCLK '515 restore form window
frmMain.WindowState = vbNormal
Result = SetForegroundWindow(Me.hwnd)
frmMain.Show
Case WM_RBUTTONUP '517 display popup menu
Result = SetForegroundWindow(Me.hwnd)
frmMain.PopupMenu mfrmMain.mPopupSys
Case WM_LBUTTONDBLCLK 'restore application
frmMain.WindowState = vbNormal
Result = SetForegroundWindow(mfrmMain.hwnd)
mfrmMain.Show
End Select
End Sub

Private Sub Form_Unload(Cancel As Integer)
mfrmMain.mnuViewMain.Checked = False
If frmMain.Visible <> False Then
With nid
.cbSize = Len(nid)
.hwnd = mfrmMain.hwnd
.uId = 1&
End With
Shell_NotifyIcon NIM_DELETE, nid
End Sub

System Tray Icon
Is anyone familar with putting a Icon in the system tray? In particular the dll functions:

Private Declare Function GetDesktopWindow Lib "user32" () As Long

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal
hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal _
lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd _
As Long) As Long

I get my icon in the system tray and a popup when I right click on the icon. Everything works but there is a glich. Here is the problem: I get the pop up menu that you get when right clicking on the system tray icon sperodically when moving the mouse around and clicking in the parent MDI form. Was this dll function not meant to be used with MDI forms?

The best I can figure from reading about the API functions is my problem lies in the MDIForm_MouseMove event. However, I have not been able to figure out where.

Any suggestions would be greatly appriciated.

Thanks,

Animaul

Here is my code:

Module

'links to the lib that allows error messages to be sent to the desktop
Private Declare Function GetDesktopWindow Lib "user32" () As Long
'links to the lib that allows a shell to be created
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

'declaring flags for the shell application
Public Const SW_HIDE = 0
Public Const SW_NORMAL = 1
Public Const SW_SHOWMINIMIZED = 2
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOW = 5
Public Const SW_MINIMIZE = 6
Public Const SW_SHOWMINNOACTIVE = 7
Public Const SW_SHOWNA = 8
Public Const SW_RESTORE = 9
Public Const SW_SHOWDEFAULT = 10
Public Const SW_SHOWNORMAL = 1 ' aka SW_NORMAL

Public Function lngRunShell(ByVal strParm As String) As Long
'declaring variables
Dim lngErr As Long
Dim hWndDesk As Long
Dim strFile As String
Dim strAction As String

lngErr = 0
hWndDesk = 0
strFile = ""
strAction = ""

'the desktop will be the
'default for error messages
hWndDesk = GetDesktopWindow() 'sends error messages to the desktop

strFile = strParm '"C:WINDOWSsystem32
otepad.exe" ' the file you want to open/etc.
strAction = "OPEN" ' action might be OPEN, NEW or other, depending on what you need to do

lngErr = ShellExecute(hWndDesk, strAction, strFile, "", "0&", SW_SHOWNORMAL)
lngRunShell = lngErr
End Function

On MDI Form:

Private Sub MDIForm_Load()
'the form must be fully visible before calling Shell_NotifyIcon
mfrmMain.Show
'mfrmMain.Refresh
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 = "Your ToolTip" & vbNullChar
End With
Shell_NotifyIcon NIM_ADD, nid
End Sub

Private Sub MDIForm_MouseMove(Button As Integer, Shift As Integer, X As _
Single, Y As Single)
'this procedure receives the callbacks from the System Tray icon.
Dim Result As Long
Dim msg As Long
'the value of X will vary depending upon the scalemode setting
If mfrmMain.ActiveControl Then
msg = X
Else
msg = X / Screen.TwipsPerPixelX
End If
Select Case msg
Case WM_LBUTTONUP '514 restore form window
frmMain.WindowState = vbNormal
Result = SetForegroundWindow(Me.hwnd)
frmMain.Show
Case WM_LBUTTONDBLCLK '515 restore form window
frmMain.WindowState = vbNormal
Result = SetForegroundWindow(Me.hwnd)
frmMain.Show
Case WM_RBUTTONUP '517 display popup menu
Result = SetForegroundWindow(Me.hwnd)
frmMain.PopupMenu Me.mPopupSys
Case WM_LBUTTONDBLCLK 'restore application
frmMain.WindowState = vbNormal
Result = SetForegroundWindow(mfrmMain.hwnd)
mfrmMain.Show
End Select
End Sub

System Tray Icon
Hi
Does anyone know anywhere I can find information on putting my application icon in the system tray?. Been having a good look on the net and found a few articles but these articles date from around Year 2000-2005.

Just wondering if theres newer information on this that I can use to implement a system tray icon?.

Also from all the info I have read it seems like theres alot of code to get the system tray icon working. Anyways, any help is appreciated.

Thanks

System Tray Icon
Hello there,

I'm trying to make a system tray icon, i'm not sure how to. Also I want to dynamically change the information on the icon so it doesnt have to be an image I just want to show abit of text, is it possible to make it like a label? if so is there anyway I can make it dynamically change.

Icon In System Tray
how do i put my program's icon in the system tray?

Icon In System Tray
Hello....Does anyone know if there is an API call or something to put the notification icon in the system tray when a DUN is connected? I know you can do it manually, but in code....?

Thanking You

System Tray ICON
ok I figured out how to make the tray Icon ect.. but I want the from to not show only show in the systray icon,
and when it's pressed..

(when the from is mininized naturally. it's running in the background but not on your task bar, just on the systray icon.. so when Icon clicked the program maxizes



any ideas?

System Tray Icon
Right, boredom set in again (it's happened before folks ), so I rewrote that funky systray-icon-thingymajig-whatcha-wanna-call-it control.

Now, before I get all nice and post the source, would anyone like to have it? And, while I'm at it - would you be willing to pay a nice "developers fee" of say, um, US$10?
Coz you see, I've got to feed my 13.5142901 or so children


Anyway... here we go...


Brian

System Tray Icon
I want my application to show system tray icon when minimised. can anyone help me

System Tray Icon Bug?
Hey all,

I'm using a system tray icon in my app, but sometimes it doesn't go away until i run my mouse over it once the app has been exited. Is this a bug? Is there a fix?

ober5861
[edit]
I notice it mainly when running it from the development environment!?

[/edit]

System Tray Icon
hi,

How do I get my program to appear in the system tray when I press cmd_systray01 (button) ?


Thanks


and I need to be able to have a menu appear on when the right mouse button is clicke don it thanx

System Tray Icon
Forget my question, I got the answer!

System Tray Icon
Hi All,

I have an application that puts an icon in the system tray. The problem is that when I try to remove it, it does not disapear until you move your mouse pointer over it...

So I run ShellNotifyIcon, passing NIM_DELETE.. However the icon does not get removed..

Any Ideas?

Add System Tray Icon
I need help...

the code adds an icon to the system tray. Also there is a menu that works when used from the form...

sysTray
|
---Restore
|
---Exit

The problem is when I right click on the icon in the system tray, I get an error " popup menu must have at least one submenu"... There are 2 submenus (restore and exit)... what's the program's problem?

Any ideas?



CODE: attached



thanks

System Tray Icon? How To?
Does any body have any code that will display an Icon in the system tray on the desktop. And when you right click on it it will display a menu. etc...

Thanks I really appreciate it.
A simple running program would work great. Thanks.

System Tray Icon
How can I put operate my app at all times and create a
shortcut in the system tray and remove it from the task
bar?

Icon In System Tray
You should draw the text to that picturebox, use Print method, and cls to clear. Also set autoredraw to true

Help With A System Tray Icon
I have looked everywhere for ActiveX controls that add and manipulate an icon in the system tray. I have seen many excellent controls, but have seen none that have a MouseEnter and MouseExit event, so I can change the icon when the mouse moves over it and moves off it. And, in another note, I am looking for button controls that mimic the style of the controls in MS Money 9(something) and in MS Bookshelf. Any help on these two topics?

------------------
Arien Talabac, author of Tiny Clock, the skinnable alarm clock for Windows--check it out at http://tinyclock.tsx.org.

How Do I Put An Icon On The System Tray
How do I put an icon on the system tray

System Tray Icon Won't Appear
Hi,

I've got an application where i putted some lines of code to display an icon in the systray when the program runs. If I do it normally in Windows XP, it works great. The problem is that when Windows starts up, so does my program, the icon doesn't appear - even with the internal call.
Does someone knows how to fix this? Is there a way for me to find out if the icon is loaded or not ( in this last case I would run the call again )?

Regards,

Kepler

Icon In The System Tray
I have to create a project in vb
but its icon should be display
when minimized only in the system
tray not in the status bar

Please provide your ideas and suggestions or any samples

System Tray Icon FAQ
Evenin' all. Sorry if this question has been posted already if so please slap me in the direction of the thread ;).

My question is concerning getting a popupmenu to appear for my system tray icon as per the FAQ here.

http://www.vbcity.com/forums/faq.asp?fid=6&cat=Windows#TID3750

Now, its not the popup menu part that i dont understand, its the following:

Code:
Private Sub Form_Mousemove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If X / Screen.TwipsPerPixelX = WM_LBUTTONDBLCLK Then
        Call Shell_NotifyIcon(NIM_DELETE, Trayicon)
        Me.Show
    ElseIf X / Screen.TwipsPerPixelX = WM_RBUTTONUP Then
        Me.PopupMenu mnuTray
    End If
End Sub


Ok above is my adaption of the code in the FAQ for when a user clicks on the icon in the system tray.

Problem:

X refers to the X coordinate of the mouse click.
Y refers to the Y coordinate of the mouse click.
WM_RBUTTONUP appears to be a constant for the right mouse button, stored as long.

So obviously there are multiple different places the user can hit the icon in the tray so X can be many different values.

My problem is basically that when X is divided by Screen.Twipsperpixel it is not equal to the number stored by WM_RBUTTONUP or any of my other buttons.

Now i had this working a few months ago and loaded up the project just there and now its all screwy and dont understand why. When i say working a few months ago it appeared that no matter where i clicked on the icon the value for "X" would always be the same but would only change depending on the type of mouse click or button.

Any ideas of what im doing wrong here? Thanks again guys!

___________________
Please may I have a cookie?

Edited by - Pulseammo on 2/6/2004 9:00:14 AM

System Tray Icon
I know there are a ton of sites on the net on how to make your program run in the system tray, but so far i havn't found any that i can understand.
If anyone would please point my to a helpful website, or post some code i would be very grateful.
thanks,
alex

How To Get An Icon On The System Tray
Hi to all of you,
I am developing a very simple application in pure VB6.0
The only thing I want when I start the computer , application will also start running and its icon will displayed on system tray.
Thanking you

Anjali

System Tray Icon
greeting vb masters. just want to ask, how can you make your program appear on your system tray as an icon. instead of appearing at your taskbar.

Copyright 2005-08 www.BigResource.com, All rights reserved