Preventing another instance in systray

Posted on 2000-04-05
Last Modified: 2010-04-04
I have an app that resides in systray.  The common code I find for preventing another instance of my app works well when my app is on the taskbar but when in the systray, it forces a taskbar icon at the same time.  Maximizing the taskbar icon produces an invisible window and the systray icon is still present.  
I've been using Mutex Handles.  Is there a better way to do this?
Question by:d32coder
LVL 13

Expert Comment

ID: 2688790
On this page you can see how to do that:

LVL 20

Accepted Solution

Madshi earned 75 total points
ID: 2688807
I'm using this:

  if (CreateMutex(nil, false, 'd32codersTrayApp') = 0) or (GetLastError = ERROR_ALREADY_EXISTS) then

You should add this as the first line of your project (dpr) like this:

  if (CreateMutex...

Regards, Madshi.

Author Comment

ID: 2701805
Love it.  Works great and with only one line of code.  Thanks!

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

705 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

18 Experts available now in Live!

Get 1:1 Help Now