Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stopping a process
Message
From
01/03/2011 13:23:34
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01029879
Message ID:
01502234
Views:
52
Why don't you simply step through the code with the debugger?

>This
>
>procedure CleanUp
>local loError, i, j
>
>IF VARTYPE(m.oAppObj) = 'O'
>  oAppObj.write_log('Entering ...'  ,program(),'1')
>endif  
>on shutdown
>ON ERROR 
>if vartype(oAppObj) <> 'O'
>   quit
>endif
>
>TRY
>
>   FOR lnI = _screen.Forms.Count TO 1 STEP - 1
>   			oAppObj.write_log('Releasing form ' + _screen.Forms[m.lnI].name,program(),'2')
>       _screen.Forms[m.lnI].Release()
>   NEXT     
>
>   if !empty(oAppObj.SQLHandle)  &&release your connection(s)...
>      sqldisconnect(0)
>   endif
>   close databases all
>   SET DATABASE TO    
>
>catch to loError
>   oAppObj.write_log('Error occurred in the CleanUp procedure: ' + loError.message,program(),'1')
>endtry
>
>local lcFileName
>local array laRV[1]
>
>try
>   i = adir(laRV,m.oAppObj.cProgDataDir +"RVC_"+'*.*')
>   if i > 0
>      for j = 1 to i
>         lcFileName = laRV(j, 1)
>         delete file (lcFileName)
>      endfor
>   endif
>catch to loError
>   oAppObj.write_log('Error occurred in the CleanUp procedure: ' + loError.message,program(),'1')
>endtry
>
>_screen.controlbox = .t.
>CLEAR EVENTS 
>if oAppObj.lDevMode
>   wait window  'Shutting Down In Dev Mode...'  timeout .5
>   if wexist('standard')
>      show window 'standard'
>   endif
>   set status bar on
>   set help to              &&can't set help to without foxhelp.hlp
>   try
>      do quit_prog
>
>      clear all
>      close all
>      release all
>   catch to loError
>      IF VARTYPE(oAppObj) = 'O'
>	      oAppObj.write_log('Error occurred in the CleanUp procedure: ' + loError.message,program(),'1')
>	    endif  
>   endtry
>
>   return
>ELSE
>	quit
>endif
>
>return
>
>
>does not prevent shutting down the windows, but it does not delete RVC files and doesn't create log file.
>
>Do you see what am I still missing?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform