Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can I shut down a 2nd running copy of VFP?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00401860
Message ID:
00401876
Views:
21
>I need to launch a small VFP 6.0 exe from within my main VFP exe to run as a sperate running windows exe. That part is simple and I have done it.
>
>The hard part is when the main app shuts down I would like to be able to have the 2nd exe shut down. I know I have the 2nd exe check every so often for whatever but if the user is shutting down his PC then it would probibly not check soon enough without eating up a lot of processing power constantly.
>
>Is there a direct way? Or do I just check for a flag in a table every 10 seconds with the 2nd exe.

You could set something up to use PostMessage() to send a WM_QUIT, or use the WSH Wscript.Shell's AppActivate and SendKeys methods to send something to the other app forcing shutdown through an OKL or something similar. If you launch the second app using API_APPRUN, you can modify it to snag the thread handle and use PostThreadMessage() to send a WM_CLOSE or WM_QUIT to the second app's message queue; I've placed an entry in the WinAPI section showing the declaration for PostThreadMessage(), and API_APPRUN is released with source, so you could modify it as you'd like. I do not have source to give you to do this; I have done similar things for use for my clients with good results.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform