Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to detect multiple instance of an application
Message
From
21/11/2001 14:01:07
 
General information
Forum:
Visual FoxPro
Category:
Installation, Setup and Configuration
Miscellaneous
Thread ID:
00584628
Message ID:
00584632
Views:
23
>Need to know if there is a good way to detect if an application is already running.
>
>I have an application that requires that only one instance be running.
>
>If someone tries to run the application again, force the one that is already running become the top application.

By referencing it with the title, you can use that approach:
IF CheckWin('My title')
   MESSAGEBOX('You can only have one instance of this application in memory.',48,'Title here')
   CANCEL
ENDIF

FUNCTION CheckWin
* Routine which sees if an application is active by looking for its
* Window title
* expC1 Window title
PARAMETER tcTitle
DECLARE INTEGER FindWindow in Win32API as FindWindow STRING, STRING
RETURN IIF(FindWindow(0,tcTitle)>0,.T.,.F.)
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform