Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Process running
Message
De
03/04/2003 09:11:44
 
 
À
03/04/2003 08:23:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00773494
Message ID:
00773512
Vues:
8
Hi,

Following is part of my main.prg borrowed from kilo fox,
which makes unique ID per project and make semaphore window whose
caption is that unique ID, and checks if that window is exsisting
before instanciating global app object.
.
.
*-- APPID is set at .H File..values is like 'myProj2003-03'
IF isAppRun(APPID)
   MESSAGEBOX(APP_ALREADY_RUNNING_LOC,48, ;
              'my application cation' )
   
   RETURN
ENDIF
.
.
goApp=CreateObject('myProj')
.
.


FUNCTION isAppRun(tcUniqueID)

LOCAL llRetVal, lcUniqueID
lcUniqueID = STRTRAN( tcUniqueID, " " )

*** First check for the existence of the Semaphore window
IF WEXIST("_Semaphore_")
	RETURN .T.
ENDIF 

*** Look for an occurrence of this ID as a Window Name
DECLARE INTEGER FindWindow IN Win32Api AS FindApp String, String
IF FindApp( NULL, lcUniqueID ) > 0
    *** We found one!  Set Return Value
	llRetVal = .T.
ELSE
    *** Create a new window with this ID
	DEFINE WINDOW _Semaphore_ IN DESKTOP ;
			FROM 1,1 TO 2,2 ;
			TITLE lcUniqueID
ENDIF

RETURN llRetVal

ENDFUNC
RGDS
HK.Lee
MCP
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform