Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Preventing an app to be started twice
Message
From
27/11/1996 15:27:48
 
 
To
26/11/1996 14:31:51
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00013585
Message ID:
00013746
Views:
32
>Is ther anyone out ther ewho can tell me how to prevent an app from starting twice (By users). A neat way please using temp tables and so on i know but there must be a easier way.


Here is a code snippet I used for my app.:

*** Change this programs running screen name to something different
*** than the window name you are looking for

MODIFY WINDOW screen TITLE "WINCALC 96"

*
*** Run Program to see if Program is already running,
*** If it is Maximize the first program and shut down this one
*
SET LIBRARY TO "LIBS\foxtools.fll" additive

GetWind = RegFn("FindWindow","CC","I")
func_ref = RegFn("PostMessage", "IIIL", "I")

wclass = 0

*** This is the apps window name to look for
winname = "WINCALC 96 Ver 1.1"


apphand = CallFn(GetWind, wclass, winname)

*** if the app was found, Maxizime that session and wuit this one.
IF apphand <> 0
=CallFn(func_ref, Apphand, 274, 61488, 0)
QUIT
ENDIF

SET LIBRARY TO
*** Set window title back

MODIFY WINDOW screen TITLE "WINCALC 96 Ver 1,1"
Previous
Reply
Map
View

Click here to load this message in the networking platform