Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to know if VFP app is already running in Windows
Message
From
16/04/2000 00:56:41
 
 
To
15/04/2000 15:09:13
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00360015
Message ID:
00360102
Views:
11
>>I am runnning into a problem with some of my less experianced users on slower PCs. They tend to keep clicking on the icon causing my EXE to start more than once. Is there a Windows call or anything that I can use to detect if my exe is already running? I assume there is an api call that returns the currently running processes in windows. The same list you get when you press ctrl/alt/delete.
>
>There has been a number of threads on this topic over the last few months. You could search messages; also a quick search of the Files section turned up #1004 which may be of use to you.

And/or you could use this code which works well for me:
***********************************************
* only start system if it is not already running
***********************************************
SET LIBRARY TO "foxtools.fll" ADDITIVE
GetWind = RegFn("FindWindow", "CC", "I")

* Set the first parameter of the call to getwind to 0, null.
wclass  = 0
winname = sgcAppTitle
apphand = CallFn(GetWind,wclass ,winname)

* If the call was successful, stop processing.
lContinue = .T.
IF apphand <> 0
    WAIT WINDOW "This program is already running. Check your task bar or press ALT+TAB to activate the program." TIMEOUT 10
    QUIT
ELSE
    *run your code here*
ENDIF
Previous
Reply
Map
View

Click here to load this message in the networking platform