Prevent duplication of systray icon

HI everyone
I've been working on a VB6 app that puts an icon in the systray.

This works fine, but I've noticed that if I execute my app again it puts another same icon in the systray.
How can I prevent this?
What I want is , if the user happens to run the app , I want to check in the systray and only add the icon if it doesnt currently exist...in other words it should only ever be there once.
I guess I need a way to enumerate thru the systray and find my icon ...if its there. Or should I be overwriting the icon with the one recently executed........not sure at this point

Thanks for your help
H
HenryV1955Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Martin LissConnect With a Mentor Older than dirtCommented:
Put this in your startup code

If App.PrevInstance Then… 'Indicates that another instance is running

Open in new window

0
 
HenryV1955Author Commented:
Hi Martin

Yes, I hadnt thought of coming at it this way....feel silly

I accept your answer, it works fine now.

Thank you
H
0
All Courses

From novice to tech pro — start learning today.