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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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 had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

623 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