Preventing another instance in systray

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?
d32coderAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
MadshiConnect With a Mentor Commented:
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
 
EpsylonCommented:
On this page you can see how to do that:

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

Eps.
0
 
d32coderAuthor Commented:
Love it.  Works great and with only one line of code.  Thanks!
0
All Courses

From novice to tech pro — start learning today.