Solved

Removing ghost icon from the system tray

Posted on 2011-02-14
6
1,315 Views
Last Modified: 2012-06-27
I have one VB6 app that shells a second VB6 app to perform FTP file uploads asynchronously.  The FTP client puts an icon in the system tray.  When the upload is complete, the app issues a NIM_DELETE and terminates, but its icon sometimes doesn't disappear -- instead it persists until the mouse is moved over it.  It seems that this behavior only began when I added logic to issue NIM_MODIFY to update the tool tip to reflect upload progress as a percent.

I took the NIM_ADD, MODIFY and DELETE code directly from an MS article, and I've triple-checked to be sure I got it right.  The article included code for a sample program, and I don't see a problem when running it, although it doesn't do anything but display an icon, allow it to be changed, allow the tool tip to be changed, and delete the icon.

In 17472429, Mark FreeSoftware suggested controlling the mouse to mouse-over the ghost icon, but only the FTP app knows when its done, and the ghost icon is only a problem after the app has terminated, therefore the app cannot do the cleanup.  The first app doesn't know when the FTP app has completed -- the user may have proceeded with some totally unrelated function.

The first app could start a timer that waits until the FTP app is no longer running, but how would i know if there is actually a ghost icon, and if so, how would I get its x/y coordinates to control the mouse?  What I'd really like is some API command that simply refreshes the System Tray...but apparently that doesn't exist.

Any ideas or suggestions would be greatly appreciated!  I'm developing and testing on XP, but the app must run on XP through Win7.

Thanks,

Pete
0
Comment
Question by:petekipe
  • 3
  • 3
6 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 34887360
strange, normally NIM_DELETE will remove the icon,
Do you do any doevents inside after NIM_DELETE?
may be call serval time in 1 second before your ftp client terminates
0
 

Author Comment

by:petekipe
ID: 34888559
I added a DoEvents after every Shell_NotifyIcon, and even tried a loop of 100 after the NIM_DELETE in Form_Terminate.  No luck.
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 34888590
does it happen when you have mutliple instances running?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:petekipe
ID: 34888659
Normally, we don't run multiple instances of the FTP client concurrently.  But the icons remain until I mouse over them -- If I don't mouse over, I'll see multiple icons after repeated runs of the client.  I've seen as many as 6 or 8 icons.
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 500 total points
ID: 34888972
that's normally when you task crash and not even call the NIM_DELETE.

Are you sure that routine get call?
0
 

Author Comment

by:petekipe
ID: 34889081
Your last question caused me to move the NIM_DELETE out of Form_Terminate and into one that actually does the FTP, immediately after the FTP is complete.  The icon is now being removed from the System Tray.  Apparently there was a timing issue with trying to delete in either Form_Terminate or Form_Unload (which I had tried earlier).  Many thanks for your help, EDDYKT!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA saving file message display 5 56
Paint/Redraw window while dragging 16 68
MS Acccess - Update Field in Table when report is printed 6 44
Using "ScreenUpdating" 6 55
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

896 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now