Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stopping a process
Message
From
01/03/2011 13:04:46
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01029879
Message ID:
01502229
Views:
59
I have a hard time trying to digest the spaghetti - I'm afraid it won't
___________________________
>>>My CleanUp procedure does not seem to run when I try to shutdown the application and I see an error that this application prevents shutdown...
>>
>>Of course it doesn't - you reset the 'on shutdown' to default at the end ...
>>
>>>      on shutdown
>>>   endif
>>>endif
>>
>>
>I removed that code, but it still does not work. I see my messagebox if I add it to Shutdown procedure, but I don't see log file, etc.
>Also, DBC files are still there, not deleted.
>
>
>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 
>   if vartype(oAppObj) = 'O'
>      if file(oAppObj.cImagesDBC +".DBC")
>         delete database (oAppObj.cImagesDBC)
>      endif
>   endif
>
>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,"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.
>
>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
>endif
>
>if program()=program(1)
>   &&not under helperw
>   try
>      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
>endif
>CLEAR EVENTS 
>return
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform