Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Single instance app
Message
From
24/02/1999 14:26:05
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00190737
Message ID:
00191065
Views:
16
>I remember using the foxtools library to ensure that only one instance of my app was running, but I seem to have misplaced that code :)
>
>Has anyone else used foxtools to accomplish this and could you post / email me a sample of your code?
>
>TIA


How about this Larry?



set libr to foxtools.fll

* FindWindow() takes two parameters and returns the handle of the
* window, HWND, if it was found.
getwind = regfn("FindWindow", "CC", "I")
setactwind = regfn("SetActiveWindow", "I", "I")

*Set the first parameter of the call to getwind to 0, null.
wclass=0
winname="THIS APP" && this should be name that appears in main title bar
apphand=callfn(getwind,wclass ,winname)

*If the call was successful, stop processing.
IF apphand<>0
=msgbox('Cannot run multiple copies of THIS APP','Notice',16)
lastwind=callfn(setactwind,apphand)
QUIT
ENDIF

set libr to


I think I got this from a KB article. HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform