* Z.PRG * Visual FoxPro 6.0 local lcCurDir PUBLIC glDEBUG wait wind nowa "Resetting developer environment..." CloseDataAll() && bxk 05.01.02 on shutdown clear program() clear program clear events * probably not needed anymore clear read all clear all close all clear macros clear menu clear window clear set library to set classlib to set procedure to on key on error on escape set help to * set resource to f:\devuti60\FOXUSER.DBF set clock status set status bar on lcCurDir = sys(5) + sys(2003) modi wind screen title lcCurDir + " - " + vers() _screen.fontname = "Courier New" _screen.fontsize = 10 _screen.fontbold = .T. set defa to &lcCurDir set century on set debug on set deleted off set escape on set exact off set hours to 24 set message to set optimize on set safety off set sysmenu to default set sysmenu on clear glDEBUG = .T. return *============================================================================== *!* PROCEDURE CloseDataAll * * Purpose: * This will close and revert all the open tables in all * the data sessions * * Special thanks again to Fletcher Johnson for this portion * of the reset code which was the winner of the $100 poker * chip contest from the Error Handling and Debugging session. * * Authors: * David Tansey * Fletcher Johnson - CIS 72647,1447 * * From http://fox.wikis.com/wc.dll?Wiki~AppShutDown~VFP * ******************************************************** PROCEDURE CloseDataAll #define MAX_SESSIONS 200 LOCAL ; lnCurrentDataSession, ; lnCurrentWorkArea, ; lcErrorCode, ; laFiles[1], ; li PRIVATE ; plError plError = .F. lcErrorCode = ON( "error") ON ERROR plError = .T. FOR lnCurrentDataSession = 1 TO MAX_SESSIONS SET DATASESSION TO ( lnCurrentDataSession ) IF plError *-- An error occured, must not have *-- any data in this datasession plError = .f. ELSE *-- Ok, we have data here FOR li = 1 TO TXNLEVEL() && bxk 05.01.02 ROLLBACK ENDFOR FOR lnCurrentWorkArea = 1 to AUSED( laFiles ) SELECT (laFiles[lnCurrentWorkArea]) IF CURSORGETPROP("BUFFERING") > 1 TABLEREVERT( .T.) ENDIF USE && close the table plError = .F. ENDFOR ENDIF ENDFOR FLUSH *-- Now reset the error handling code IF NOT EMPTY( lcErrorCode ) ON ERROR &lcErrorCode ELSE ON ERROR ENDIF