Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Foxpro running twice
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00184311
Message ID:
00185135
Views:
18
>>>>Make that "not real sure of what you're trying to do".
>>>>
>>>>Geez, it's Monday isn't it?:-)
>>>
>>>All day unfortunately.
>>>
>>>I AM trying to prevent a 2nd instance or at least warn the user.
>>>using the:
>>>
>>>lnhWnd = Is_Run32('funds program')
>>>IF lnhWnd > 0
>>> * It's running
>>>ENDIF method
>>>
>>>seems like an easy way to do it. Am I on the right track?
>>
>>Yep, it's simple and direct. One of the reasons that I used the mutex in the article is that it's one of the documented ways to prevent multiple instances of an application. It's also faster than looping through the windows.
>\
>Quest is, does that code just above, test for the SECOND instance only?

Either method, Tim, is going to test for a previous instance. One word of caution about using Is_Run32() to test for a previous instance. I haven't checked this out, but there's a chance (if my recollection of how the Z-order in Windows works is correct, a good one) of getting back the window handle for the application that's doing the testing. To circumvent that. Set the .Caption to an empty string prior to calling the function, then restore it after you've determined that the program isn't running.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform