Eurico,
This should do the job:

*********
* Start Code
*
FUNCTION AppAlreadyRunning
LOCAL hsem, lpszSemName
#define ERROR_ALREADY_EXISTS 183
DECLARE integer GetLastError IN win32API
DECLARE integer CreateSemaphore IN WIN32API ;
  string @ lpSemaphoreAttributes, ;
  LONG lInitialCount, ;
  LONG lMaximumCount, ;
  string @ lpName
lpszSemName = "MyUniqueApplicationName" && Whatever you want per your app
hSem = CreateSemaphore(0,0,1,lpszSemName)
RETURN (hsem # 0 AND GetLastError() == ERROR_ALREADY_EXISTS)
*
* End Code
************

Dave Crozier

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Eurico Chagas Filho
Sent: 14 July 2009 12:12
To: 'ProFox Email List'
Subject: How to avoid two instances


I came across a code written by Ramani to avoid two instances of an
application in the same desktop.
It uses extensively the DDE functions, is there anything I should be aware
of ?

TIA, E.



[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/20d43af0bf174dd6b6085a0063189...@develop
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to