Solved

Preventing another instance in systray

Posted on 2000-04-05
3
197 Views
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?
0
Comment
Question by:d32coder
[X]
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
3 Comments
 
LVL 13

Expert Comment

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

http://www.gnomehome.demon.nl/uddf/pages/api.htm#api0

Eps.
0
 
LVL 20

Accepted Solution

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

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

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

begin
  if (CreateMutex...
  Application.Initialize;
  Application...
  ...
end.

Regards, Madshi.
0
 

Author Comment

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

739 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