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:
00409182
Views:
35
George,
It appears that CreateEvent and CreateMutex behave the same way in this respect. From the WinSDK Help on CreateMutex:

Use the CloseHandle function to close the handle. The system closes the handle automatically when the process terminates. The mutex object is destroyed when its last handle has been closed.

From the WinSDK Help on CreateEvent:

Use the CloseHandle function to close the handle. The system closes the handle automatically when the process terminates. The event object is destroyed when its last handle has been closed.

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.

*snip*
>I really like Ed's suggestion. In fact, I like it better than my Mutex solution. Why? Well, for one, I think it cleans up after itself better than a Mutex. In a development environment, if you create a mutex and run the EXE from within VFP, after you shut the program down, you have to do some cleaning up in releasing the mutex. If you don't, you have to exit VFP and re-start. So what you have is code that's only necessary for use at design time. From what I can tell from Ed's post, because it relies on PROGRAM(0), it should automatically release itself when the executable exits. Of course, I haven't had a chance to test this, but if this assumption is correct, there's less code for someone to have to maintain.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform