HI
Going thru my code above which I wrote with some mix of my code from some Prgs(cut copy paste), and in the process missed some thing. So reposting it so that any future users dont make a mistake..
1. Example... My Main.Prg
**********************
ON SHUTDOWN DO myShutDown
ON ERROR DO errhand WITH ;
ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO(1)
DO FORM myMainForm
READ EVENTS
CLEAR EVENTS
ON ShutDown
QUIT
*********************************************************
PROCEDURE myShutDown
CLEAR EVENTS
ON ShutDown
QUIT
*********************************************************
** My error handler
PROCEDURE errhand
PARAMETER merror, mess, mess1, mprog, mlineno
LOCAL myMessage
myMessage='Error number: ' + LTRIM(STR(merror))+ CHR(13) ;
+ 'Error message: ' + mess + CHR(13) ;
+ 'Line of code with error: ' + mess1 + CHR(13);
+ 'Line number of error: ' + LTRIM(STR(mlineno)) + CHR(13) ;
+ 'Program with error: ' + mprog
=MESSAGEBOX(myMessage,"ERROR !!!",16)
RETURN
*********************************************************
** EOF
*********************************************************
2. In the Final quit place, call the myShutDown by code..
DO myShutDown
This is to ensure that ON SHUTDOWN, CLEAR EVENTS are all processed correctly.
********************************************************
The error in my earlier posting is... no ON ShutDown command to clear the earlier code. If you simply type on the command window..
ON ShutDown CLEAR EVENTS
And now press the X at the titlebar. VFP wont close down.
Now type on the command window.. ON ShutDown
and thentry. It will close.
____________________________________________
ramani - (Subramanian.G) 
When you ask VFP questions, please add VFP version.