?
Solved

Icon in system tray problem

Posted on 2000-01-25
9
Medium Priority
?
310 Views
Last Modified: 2010-05-02
Hi, I have a program, that when minimised runs in the system tray. Everything appears to work ok, until I quit the program. The icon for the program still sits in the system tray until i move the mouse over it, then it goes. This only happens when i click the quit button in my program which just uses End. If i click on the close button in the top right hand side of the window then the icon disapears straight away.
how can i get the icon to disappear as soon as the program is terminated.

thanks in advance
MICK

0
Comment
Question by:mickb
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 13

Expert Comment

by:crazyman
ID: 2385381
This is a very common problem and i have never seen a decent soloution.
I may be wrong so lets see if any one else can solve this.
0
 
LVL 14

Expert Comment

by:waty
ID: 2385413
Use the code to put in the tray you can find on my web site :

www.geocities.com/researchtriangle/6311
0
 
LVL 14

Expert Comment

by:waty
ID: 2385417
It is very easy to use, I use it for most of my app :)
And no problem :)
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LVL 43

Expert Comment

by:TimCottee
ID: 2385422
I assume that you have something similar to  
Shell_NotifyIcon NIM_DELETE, nid

in the form_unload event
0
 
LVL 6

Expert Comment

by:st_steve
ID: 2385514
TimCottee is correct but he didn't give you the complete code...here's the complete code..

put this code in FOrm_Unload event

Dim lngRetVal As Long
'return the correct windows handler
lngRetVal = SetWindowLong(lngHwnd, GWL_WNDPROC, lngPrevWndProc)
       
'remove icon
Shell_NotifyIconA NIM_DELETE, nidTray

Of course you have to declare the SetWindowLong API but since you're already writing System Tray applications, I assume you know how to do that.

Let us know.

0
 
LVL 3

Accepted Solution

by:
Gordonp earned 200 total points
ID: 2387976
mickb, your problem is your using End to stop your app.

as unloading the form using the x works ok, call

unload <FormName>

before using End.

Gordon
0
 

Author Comment

by:mickb
ID: 2388042
Thanks gordon that worked a treat, and it was so simple.

thanks again
MICK
0
 
LVL 6

Expert Comment

by:st_steve
ID: 2388811
glad someone solved the question!
0
 

Author Comment

by:mickb
ID: 2388875
Yes thanks to everyone who helped. hopefully it may help someone else with a similar problem
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question