Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A New Twist On Is App Running
Message
De
31/05/2007 05:13:19
 
 
À
31/05/2007 04:23:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00409058
Message ID:
01229520
Vues:
15
>>Just a reminder, I'm running Windows Vista Business for this test.

I don't have it, so I can't test this on that platform. But I don't think that is the problem, I think this should still work.

>>In respect of a code sample, I am using the
>>exact code as per Ed's original post below. No change.

Eds code has a =CloseHandle(nEH) at the end and no wait mechanism in it to keep the code running (it closes the event and exits immediately) so, if you are really running it EXACTLY as he posted it then your results are correct because the first program has already terminated and the event has been closed, before the second copy was ever run.

The fact that both instances returned the same handle tends to indicate that the handle was released by the first app. If it wasn't released then it wouldn't be available for the second app to use. They should both return different handles when this is working.

My code was an adjustment to Eds code that I made solely for testing from the command window. It will print "Error I was allowed to Execute" to the screen if Eds code fails.

If you have done something to pause the first program so that it stays running while you execute the second copy and you still get the second app being allowed to run.

Try:

nEH = CreateEvent(0,0,1, 'Global\' + PROGRAM(0) + '.EVENT')

Maybe the changed the default for that in Windows Vista?

John

>Hi John.
>
>Thanks for the reply. If I use:
>
>
>nEH = CreateEvent(0,0,1, CHRTRAN(_VFP.ServerName + '.EVENT',"\","_"))
>
>
>I get a non-zero handle number and geterror() = 0. When I load the second instance of the app I get the same handle number and geterror() still returns 0. Hence both apps load.
>
>In respect of a code sample, I am using the exact code as per Ed's original post below. No change. If I use PROGRAM(0) same thing. For both instances that I load of the exe I get the same PROGRAM(0) (my start program), I get the same handle for both, and no error. Therefore the line:
>
>
>
>IF GetLastError() = 183 OR lnEH = 0
>
>
>does not result in .T. There is no error and I get a non-zero handle.
>
>Just a reminder, I'm running Windows Vista Business for this test.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform