Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A New Twist On Is App Running
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00409058
Message ID:
00409266
Views:
29
>>The ReleaseMutex has a corresponding ResetEvent. It appears you would have to shut VFP down either way because the process would have to terminate in order for it to go away on its own.
>>
>>Just some thoughts from a WinAPI layman.
>>
>Nice catch, Larry. In fact, I just finished testing this and, unfortunately, like creating a mutex, you have to clear the Event, apparently using ResetEvent() followed by a close. Serves me right for opening my mouth before reading the SDK.< g >

NO, NO, NO...I don't leverage anything from the event.

Issuing a CloseHandle() with no other process holding an event handle makes the event object disappear, regardless of the state. If you forget to CloseHandle, issuing a CLOSE ALL, or QUITting VFP releases the handle and makes the event go away. I'm actually leveraging the CreateEvent() behavior rather than the Event itself; the existance of the Event serves as an indication that someone else already is running, and is still running.

Try it. There's no causal link between PROGRAM(0) - it's just a name that's easily codified; presumably any instance of the program you're running will have the same PROGRAM(0), so even if you cancel out, a CLOSE ALL or calling CloseHandle() avoids the need to exit VFP. RTFMSDN
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform