Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Abort
Message
From
02/12/2000 02:24:45
 
 
To
01/12/2000 20:25:57
John Tomblin
Service Station Systems, Inc.
San Jose, California, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00448407
Message ID:
00448450
Views:
13
>Like everyone else I start applications with a .PRG which sets the environment, displays a splash screen, loads a menu system, etc. I check to see if the user is a valid user. if not I display a message and then I would like to exit the application. To exit I have a function called "Depart". When I do Depart the application does not close. What can I add to make the app close?
>
>*-------------------------------------------------------------------------------

In addition to Barbara's recommendation, if you are creating any objects that might not get released and could be actively executing, you may need to release them as well. If you're really exiting, you need to release all Forms and objects - dangling object references may be an issue as well. At a minimum, I'd try explicitly releasing all Forms in the _SCREEN.Forms collection, either with a FOR...NEXT loop that decrements, or something like:
FUNCTION Depart
LPARAMETER tlNoDebug
CLEAR EVENTS
POP KEY ALL
SET ASSERTS ON
ON SHUTDOWN
DEACTIVATE WINDOW ALL
_SCREEN.Hide()
SET SYSMENU TO DEFAULT
SET LIBRARY TO
ASSERT _SCREEN.Show() AND ''=SYS(3056) AND tlNoDebug 'Forms Deactivated'
WITH _SCREEN
   DO WHILE .FormCount > 0
      .Forms(.FormCount).Release()
   ENDDO
ENDWITH
ASSERT tlNoDebug 'Forms Released'
RETURN .F.
With dangling object refs, you still may need a CLEAR ALL

>function Depart
>
>clear events
>deactivate window all
>pop key all
>on shutdown
>
>if _VFP.StartMode = 0 && Development Mode
> set sysmenu to default
> set library to
> modify window screen
> =sys(3056) && Reread Registry and config.vfp settings
>endif
>
>return .F.
>*-------------------------------------------------------------------------------
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