Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Preventing Multiple Launches
Message
 
To
02/12/1999 12:47:03
Michael Dougherty
Progressive Business Publications
Malvern, Pennsylvania, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00296974
Message ID:
00298020
Views:
19
>the DDE method looks fairly straightforward/simple compared to the mutex article refered by George Tasker. Unfortunately, the machines expected torun this application are notoriously unstable. The DDE method requires some shut-down code, which may not get a chance to run. If a disconnected flag could prevent a 'recovered' windows system from running the application, then it'll introduce new headaches...
>
>I'm going to try the mutex example, and hope i can make sense of the API calls since i've never used them before. Most likely, i'll be back for more help. :)

Hi Michael,

Allow me to suggest a thrid method and go over some of the pros and cons of each of the three. First, another method...

In the Download section, under Win32 and other APIs, you'll find "Is a Windows application running". This is a function named Is_Run32(). It takes the known portion of the title bar, and tries to determine if a window with that title exists. If it does, it returns the window handle. If not, zero. This may be the easiest to implement. You'd simply call the function prior to assigning the caption to _SCREEN or your main form with the intended caption. If non-zero is returned, it's already running. Otherwise, it isn't.

The downside here is that if you have a case where part of one applications caption might be in another, it could fail.

DDE is easy to implement, but then again, the possibility of DDE errors (such as a timeout on a busy machine) may occur that would lead to an incorrect conclusion as to whether or not the application was running.

The mutex is the most complex, but also the most reliable in terms of making the determination. Unfortunately, if the code to release the mutex (which is in shutdown) doesn't execute, the mutex isn't released. This can happen if VFP generates a 0xC0000005 error (GPFs). Further, this can and does happen if VFP 6.0 without SP3 and DCOM95 (under Win95) isn't installed with top-level type application (_SCREEN.Visible = .F.).

hth,
George

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

Click here to load this message in the networking platform