Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check for running instance
Message
De
30/07/1997 17:47:33
 
 
À
30/07/1997 15:09:35
Lamar Glover
Southeastern Apparel, Inc.
Dothan, Alabama, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00018581
Message ID:
00042494
Vues:
43
>>>Is there any way to check when a user clicks on
>>>the Windows Icon to see if an instance of an
>>>application is running? I Have an exe out there
>>>that users are trashing because they minimize it,
>>>forget, and call it up again multiple times.
>>
>>Yes, it should be done at the icon level because most of times, when developers are putting the code to detect inside the setup program, the second instance will not even be able to load because of a low memory.
>>
>>Having it at the icon level will also give you instance switch to your application or load it.
>>
>>We normally use a small C program for that. If you want I can put you in contact with my C resource and he'll talk you more about his C detect program. A few of us, here in the Universal Thread, are already using his routine.
>
>
>Michel,
>
>Can you send me some information on this C program.
>
>Thanks
>Lamar Glover lglover@ala.net
How about the following:
Use DDE/
=DDESetOption('SAFETY',.F.)
lnChannel=DDEInitiate('YourApplicationControlName','SYSTEM')
if lnChannel<>-1
=messagebox('Only One Copy Of YourApplicationControlName May Run On This System At A Time',16,YourApplicationControlName')
quit
endif
=DDESetService('YourApplicationControlName','DEFINE')

PUBLIC goApp
goApp = CREATEOBJECT(APPCLASS)
IF TYPE('goApp') = "O"
RELEASE gcOldTalk, gcOldDir, gcOldPath, gcOldClassLib, gcOldProcedure
goApp.Do() && there is our DO method mentioned in another thread
ENDIF

*-- Free DDE Lock Name
=DDESetService('YourApplicationControlName','RELEASE')

Got this idea from a FoxAdvisor note I believe.
You should also add teh RELEASE to any cleanup/destory/on shutdown etc. since the service name will exist until you reboot. This should also work in NT
HTH Gary
Gary
Helping Make Ideas Reality
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform